collapse collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 81
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM

* Recent Posts

Re: v 2.3.3 to v2.3.7 by ♦ Ninja ZX-10RR ♦
[December 11, 2018, 04:14:48 PM]


v 2.3.3 to v2.3.7 by rollingrock
[December 11, 2018, 09:36:20 AM]


[Block] Help with editing few lines on Simpleportal by Wallen
[December 09, 2018, 05:10:34 AM]


Re: LinkTree by Chen Zhen
[November 15, 2018, 02:24:51 PM]


Re: blocks showing user avatars by hulapyk
[November 15, 2018, 01:47:11 PM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: SMF Social Groups Block  (Read 13303 times)

0 Members and 1 Guest are viewing this topic.

Offline NIBOGO

  • Semi Newbie
  • *
  • Posts: 35
  • Gender: Male
    • SMFPacks
  • SMF Version: 2.0.2
  • SP Version: None
SMF Social Groups Block
« on: March 09, 2010, 09:36:05 PM »
This is a block to show the recent groups in the SMF Social Groups Mod:

Create a new php block and add this content:

SMF 2.0

Code: [Select]
global $smcFunc, $scripturl;

 echo'Recent Groups:<br />';

$dbresult = $smcFunc['db_query']('', '
   SELECT id_group, group_name, image
   FROM {db_prefix}social_groups
   ORDER BY id_group DESC
   LIMIT 5'); 
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
   echo'<a href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['id_group'].'"><img src="'.$row['image'].'" alt="'.$row['group_name'].'" /></a>';
}
$smcFunc['db_free_result']($dbresult);

SMF 1.1.X:

Code: [Select]
global $db_prefix, $scripturl;

 echo 'Recent Groups:<br />';

$dbresult = db_query('
   SELECT ID_GROUP, groupName, image
   FROM {$db_prefix}social_groups
   ORDER BY ID_GROUP DESC
   LIMIT 5', __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($dbresult))
{
   echo'<a href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['ID_GROUP'].'"><img src="'.$row['image'].'" alt="'.$row['groupName'].'" /></a>';
}
mysql_free_result($dbresult);

Best Regards
« Last Edit: March 12, 2010, 02:42:48 PM by NIBOGO »


Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: SMF Social Groups Block
« Reply #1 on: March 10, 2010, 01:26:46 AM »
Moved to the Blocks and Modifications board.

Note for all, this block will only work for SMF 2.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Offline NIBOGO

  • Semi Newbie
  • *
  • Posts: 35
  • Gender: Male
    • SMFPacks
  • SMF Version: 2.0.2
  • SP Version: None
Re: SMF Social Groups Block - Only for SMF 2.0
« Reply #2 on: March 11, 2010, 09:09:48 PM »
Moved to the Blocks and Modifications board.

Note for all, this block will only work for SMF 2.

Thanks for remind me, already added to the topic title


Online Kaede Akamatsu

  • Hero Member
  • *****
  • Posts: 2176
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: SMF Social Groups Block - Only for SMF 2.0
« Reply #3 on: March 12, 2010, 12:50:57 AM »
For SMF 1.1...

Code: [Select]
global $db_prefix, $scripturl;

 echo 'Recent Groups:<br />';

$dbresult = db_query('
   SELECT ID_GROUP, groupName, image
   FROM {$db_prefix}social_groups
   ORDER BY ID_GROUP DESC
   LIMIT 5', __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($members_result))
{
   echo'<a href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['ID_GROUP'].'"><img src="'.$row['image'].'" alt="'.$row['groupName'].'" /></a>';
}
mysql_free_result($dbresult);

Offline NIBOGO

  • Semi Newbie
  • *
  • Posts: 35
  • Gender: Male
    • SMFPacks
  • SMF Version: 2.0.2
  • SP Version: None
Re: SMF Social Groups Block - Only for SMF 2.0
« Reply #4 on: March 12, 2010, 02:41:16 PM »
For SMF 1.1...

Code: [Select]
global $db_prefix, $scripturl;

 echo 'Recent Groups:<br />';

$dbresult = db_query('
   SELECT ID_GROUP, groupName, image
   FROM {$db_prefix}social_groups
   ORDER BY ID_GROUP DESC
   LIMIT 5', __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($members_result))
{
   echo'<a href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['ID_GROUP'].'"><img src="'.$row['image'].'" alt="'.$row['groupName'].'" /></a>';
}
mysql_free_result($dbresult);


There is a error in that code that I already fix in the SMF 2.0 version, here is the patched version:

Code: [Select]
global $db_prefix, $scripturl;

 echo 'Recent Groups:<br />';

$dbresult = db_query('
   SELECT ID_GROUP, groupName, image
   FROM {$db_prefix}social_groups
   ORDER BY ID_GROUP DESC
   LIMIT 5', __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($dbresult))
{
   echo'<a href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['ID_GROUP'].'"><img src="'.$row['image'].'" alt="'.$row['groupName'].'" /></a>';
}
mysql_free_result($dbresult);

Thanks ccbtimewiz :)


Online Kaede Akamatsu

  • Hero Member
  • *****
  • Posts: 2176
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: SMF Social Groups Block
« Reply #5 on: March 12, 2010, 11:25:36 PM »
You're welcome.

Offline Mick.

  • Comrade
  • *
  • Posts: 76
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SMF Social Groups Block
« Reply #6 on: March 29, 2010, 07:22:21 PM »
Can the group name be added above the group image?  :|

Offline NIBOGO

  • Semi Newbie
  • *
  • Posts: 35
  • Gender: Male
    • SMFPacks
  • SMF Version: 2.0.2
  • SP Version: None
Re: SMF Social Groups Block
« Reply #7 on: April 02, 2010, 11:23:41 PM »
Can the group name be added above the group image?  :|

Sure:

Code: [Select]
global $smcFunc,   $scripturl;

 echo'Recent Groups:<br />';

$dbresult =   $smcFunc['db_query']('', '
   SELECT id_group, group_name, image
     FROM {db_prefix}social_groups
   ORDER BY id_group DESC
   LIMIT   5'); 
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
     echo'<a   href="'.$scripturl.'?action=sgroups;sa=view;id='.$row['id_group'].'"><img   src="'.$row['image'].'" alt="'.$row['group_name'].'" /><br />'.$row['group_name'].'</a>';
}
$smcFunc['db_free_result']($dbresult);

You can use some tags to center the text like <div align="center">'.$row['group_name'].'</div>


Offline EvilGeneral

  • Semi Newbie
  • *
  • Posts: 13
  • Gender: Male
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: SMF Social Groups Block
« Reply #8 on: May 04, 2011, 04:38:30 PM »
Isn't work for me. =[
The image path is wrong.

PS: Most difficult thing in this forum is type the correct captcha. lol

Offline angeljs

  • Newbie
  • Posts: 2
  • Gender: Female
    • UK Council House Exchanges
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: SMF Social Groups Block
« Reply #9 on: June 18, 2015, 10:09:01 AM »
The image link isn't working, how can this be fixed?

Offline angeljs

  • Newbie
  • Posts: 2
  • Gender: Female
    • UK Council House Exchanges
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: SMF Social Groups Block
« Reply #10 on: June 18, 2015, 10:28:20 AM »
Okay, I managed to fix the broken image link. Simply replace this piece of code:

Code: [Select]
<img src="'.$row['image'].'" alt="'.$row['group_name'].'" />
With this:

Code: [Select]
<img src="http://www.fullurltoyourboard.com/sogroups/'.$row['image'].'" alt="'.$row['group_name'].'" />
Replace the link with the full link to your forum installation and it should work. I'm not a coder, so this is only a quick fix, if anyone has a better idea it would be appreciated.  :D
« Last Edit: June 19, 2015, 05:02:52 PM by angeljs »