News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Need Facebook "Like" mod testers

Started by Mick., April 22, 2010, 08:56:25 PM

Previous topic - Next topic

Arantor

What's the code both before and after that?

Mick.

#21
Quote from: Arantor on April 25, 2010, 08:05:37 PM
What's the code both before and after that?

Oh hey man,...  this is the updated xml.   What im trying to do is, add board specific permissions.


Mayhem30

Could someone please tell me what variable is used to pull the URL for SMF 1.1.x?

Arantor

What do you mean by board specific permissions, exactly? Do you mean have it stored in the boards management (as an admin on/off option) or a board permission as managed in the permissions area?

Mick.

Quote from: Arantor on April 25, 2010, 08:24:04 PM
What do you mean by board specific permissions, exactly? Do you mean have it stored in the boards management (as an admin on/off option) or a board permission as managed in the permissions area?

In admin--->forum---->modify boards, the admin can tick the box if he wants the "facebook Like" button visible. 

Arantor

Reason being is that the echo then carries on the next code, so if the expression fails it all goes haywire.

Try this:
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<name>Facebook_Like v.1.2</name>
<id>BlueDevil:Facebook_LIke</id>
<version>1.2</version>


<file name="$sourcedir/Display.php">
<operation>
<search position="before"><![CDATA[ $context['is_approved'] = $topicinfo['approved'];]]></search>
<add><![CDATA[
//Facebook Like
$context['facebookLike_board_enable'] = $board_info['FacebookLike_board_enable'];
]]></add>
</operation>

        </file>


   <file name="$themedir/Display.template.php">

      <operation>
         <search position="replace"><![CDATA[ <span id="author">', $txt['author'], '</span>]]></search>
         <add><![CDATA[
<span id="author">', $txt['author'], '</span>';
      //Facebook Like     
      if( !empty($modSettings['facebookLike_allow']) && !empty($context['facebookLike_board_enable']) && !$context['user']['is_guest'])
echo '
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'your app id\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>
               <!-- Facebook Like Button -->
               <span style="float:right; margin-top:4px;">
                  <fb:like href=', $scripturl, '?topic=', $context['current_topic'], 'layout="standard" show_faces="false" width="450" action="like" colorscheme="light" />
               </span>
               <!-- End of Facebook Like Button -->';

echo '
]]></add>
      </operation>

   </file>


<file name="$themedir/ManageBoards.template.php">
<operation>
<search position="after"><![CDATA[
// Here the user can choose to force this board to use a theme other than the default theme for the forum.
]]></search>
<add><![CDATA[


// Add the Facebook LIke
echo '
<div id="board_theme_div">
<dl class="settings">
<dt>
<strong>', $txt['facebookLike_board_enable'], ':</strong><br />
<span class="smalltext">', $txt['facebookLike_board_enable_desc'], '</span><br />
</dt>
                        <dd>
<input type="checkbox" name="facebookLike_board_enable" ', $context['board']['facebookLike_board_enable'] ? ' checked="checked"' : '', ' class="check" />
</dd>
</dl>
           </div>';
]]></add>

</operation>

        </file>


<file name="$sourcedir/ManageSettings.php">
<operation>
<search position="before"><![CDATA[
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!
]]></search>
<add><![CDATA[

array('check', 'facebookLike_allow'),
'',

]]></add>

</operation>

        </file>




<file name="$sourcedir/ManageBoards.php">
<operation>
<search position="before"><![CDATA[
$boardOptions['posts_count'] = isset($_POST['count']);
]]></search>
<add><![CDATA[

$boardOptions['facebookLike_board_enable'] = isset($_POST['facebookLike_board_enable']); //Facebook Like
]]></add>
               </operation>

               <operation>
<search position="before"><![CDATA[
'theme' => 0,
'profile' => 1,
'override_theme' => 0,
]]></search>
<add><![CDATA[

'facebookLike_board_enable' => 0,
]]></add>
</operation>

        </file>



<file name="$sourcedir/Subs-Boards.php">
<operation>
<search position="before"><![CDATA[ $boardOptions += array(
'posts_count' => true,]]></search>
<add><![CDATA[
'facebookLike_board_enable' => false,]]></add>
</operation>

<operation>
<search position="before"><![CDATA[ b.board_order, b.count_posts, b.member_groups, b.id_theme, b.override_theme, b.id_profile,]]></search>
<add><![CDATA[
b.facebookLike_board_enable,]]></add>
</operation>

<operation>
<search position="before"><![CDATA[ 'count_posts' => empty($row['count_posts']),]]></search>
<add><![CDATA[
'facebookLike_board_enable' => $row['facebookLike_board_enable'],]]></add>
</operation>

<operation>
<search position="after"><![CDATA[ // Set the theme for this board.]]></search>
<add><![CDATA[
// Enable or disable the Facebook Like mod in any board.
if (isset($boardOptions['facebookLike_board_enable']))
{
$boardUpdates[] = 'facebookLike_board_enable = {int:facebookLike_board_enable}';
$boardUpdateParameters['facebookLike_board_enable'] = (int)$boardOptions['facebookLike_board_enable'];
}]]></add>
</operation>
</file>


<file name="$sourcedir/Load.php">
<operation>
<search position="before"><![CDATA[ b.id_theme, b.override_theme, b.count_posts, b.id_profile,]]></search>
<add><![CDATA[
b.facebookLike_board_enable,]]></add>
</operation>

<operation>
<search position="before"><![CDATA[ 'posts_count' => empty($row['count_posts']),]]></search>
<add><![CDATA[
'facebookLike_board_enable' => $row['facebookLike_board_enable'],]]></add>
</operation>
</file>



<file name="$themedir/languages/Modifications.english.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
//Begin mod Fecebook Like
$txt['facebookLike_allow'] = '[FacebookLike] Enable Topic Like in your forum?';
$txt['facebookLike_board_enable'] = 'Enable Facebook Like on topics [Facebook Like mod]';
$txt['facebookLike_board_enable_desc'] = 'This option allows people to Like the topics they are reading.';
//End mod Facebook Like

]]></add>
</operation>
</file>

<file name="$themedir/languages/Modifications.english-utf8.php" error="skip">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
//Begin mod Fecebook Like
$txt['facebookLike_allow'] = '[FacebookLike] Enable Topic Like in your forum?';
$txt['facebookLike_board_enable'] = 'Enable Facebook Like on topics [Facebook Like mod]';
$txt['facebookLike_board_enable_desc'] = 'This option allows people to Like the topics they are reading.';
//End mod Facebook Like

]]></add>
</operation>
</file>

</modification>


As you can see I've ended the FB edits and added a new echo statement which won't be in the scope of the if expression.

Mick.

OMG, i cant believe i missed that.

';

   echo '


I need a break ive been working on it all day.

Thanx Arantor that worked.

Mick.

Mod now repacked and sent to the mod site for approval.

Now uses board permissions.   Thanx Arantor, Yagiz for the help.  .......and also thanx to Dismal Shadow for the idea.


Mayhem30

Could someone please port this mod over to SMF 1.1.11

kosty555

I needs this mod - but I can not find where i can download it?
World Celebs [nofollow]

~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

aw06

Quote from: vbgamer45 on April 25, 2010, 10:47:28 AM
Simple to add to 1.1.x I added it to some of my forums.

Can you share how to add to 1.1.11
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

ajg

i will be interested on a 1.1.11 version.. thanks in advance

ormuz


Mick.

Ok i'll bite.


Im making progress.....  :P

nsno


kosty555

How long to wait for the finished mod? When it is approved?
World Celebs [nofollow]

Mick.

Rc3 is ready in the mod site waiting approval.

I started working for the 1.1.x but it may be a while as i have chores to do at home and i have a plumbing leak in my laundry room that needs fixed.

The 1.1.x will be added when finished in a separate package as i dont want it mixed with rc3.

....besides,...i dont know anything of 1.1.x so im also studying it to add board permissions and a database like the rc3 mod.

alphacaveman

I'll be jumping for joy when it's ready for 1.1.x!

KensonPlays

When will it be available? I'd use it for reasons for a few of my facebook friends...

Owner of Mesozoic Haven

Advertisement: