A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Forums > Special Group Message - Which file controls this?
Aug 31, 2010
8:20 pm
Rookie
Forum Posts: 4
Member Since:
Sep 1, 2010
Offline

Hi,

 

I need to find out which file contains the output for the special group message.

 

I want it to only display for certain users.

 

Thanks

Sep 1, 2010
2:40 am

SP Master
Forum Posts: 22240
Member Since:
Nov 9, 2008
Offline

/forum/sf-group-view.php for the 'group' message. /forum/sf-forum-view.php for the forum message. Look for the 'special message' comment.
You could accomplish the same thing using a program hook and wouldn't need to edit core code. See the wiki, plugin api section.

Yellow Swordfish
Sep 14, 2010
12:15 am
Rookie
Forum Posts: 4
Member Since:
Sep 1, 2010
Offline

Thanks. I will take a look at the hooks to accomplish this.

Sep 14, 2010
8:22 am

SP Master
Forum Posts: 23688
Member Since:
Dec 10, 2006
Offline

let us know if you have any questions as you work through it…

Sep 17, 2010
11:43 am
Rookie
Forum Posts: 4
Member Since:
Sep 1, 2010
Offline

The Existing Group Hooks did not work for me since I am trying to add in conditional Special Group Messages, but I did get everythjing working by adding in a "new" hook.

 

Add the following into the Front/Main Page – Group/Forum Listing area of simple-forum/forum/hooks/sf-hook-template.php

 

/* ---------------------------------------------------
    sf_hook_special_group_message($groupid)
    Displays content after each Special Group Message on the main/front
    Forum listing page. The GROUP_ID is passed if needed.
    ------------------------------------------------------ */

    function sf_hook_special_group_message($groupid)
    {
        if(condition is met)
        {
             $sgm = 'Your message here';
        }
        return $sgm;
    }

 

Then change the following in simple-forum/forum/sf-group-components.php

From:

# = SPECIAL FORUM MESSAGE =====================
if(!function_exists('sf_render_special_group_message')):
function sf_render_special_group_message($message)
{
    $out = '<div class="sfgroupmessage sfmessagestrip"><p>'.$message.'</p></div>'."\n";
    return $out;
}
endif;

 

To:

# = SPECIAL FORUM MESSAGE =====================
if(!function_exists('sf_render_special_group_message')):
function sf_render_special_group_message($message, $groupid)
{
    $out = '<div class="sfgroupmessage sfmessagestrip"><p>'.$message;
    # Get Program Hook
    $out.= sf_process_hook('sf_hook_special_group_message', $groupid).'</p></div>'."\n";
    return $out;
}
endif;

 

Then change the following in simple-forum/forum/sf-group-view.php

From:

# Special Message
if(!empty($group['group_message']))
{
   $out.= sf_render_special_group_message(sf_filter_text_display($group['group_message']));
}

 

To:

# Special Message
$out.= sf_render_special_group_message(sf_filter_text_display($group['group_message']),$group['group_id']);

 

This worked for me, but if anyone can simplify this and/or make it more efficient, please let me know. Also, would it be better to use a pluggable function?

Sep 17, 2010
12:21 pm

SP Master
Forum Posts: 23688
Member Since:
Dec 10, 2006
Offline

not sure why a conditional has anything to do with it… you could have used an existing hook though might have been in slightly diff location…

v5.0 will offer a true plugin api so you can do this even easier…

Forum Timezone: America/Chicago

Most Users Ever Online: 444

Currently Online: Conrad_Farlow, steve.engelking, jawaulk, irlandes1, joelrob
75 Guest(s)

Currently Browsing this Page:
1 Guest(s)

See All Online Activity

Top Posters:

-Radio-: 1251

Lee H: 606

Luffer: 535

Conrad_Farlow: 502

jim: 478

neon: 263

ovizii: 240

Tal: 240

Member Stats:

Guest Posters: 2626

Members: 7363

Moderators: 1

Admins: 2

Forum Stats:

Groups: 5

Forums: 16

Topics: 10897

Posts: 79582

Moderators: Brandon C (162)

Administrators: Yellow Swordfish (22240), Mr Papa (23688)