Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Hats off to the Developers!
Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Feb 23, 2012 - 3:15 pm

The error is nothing big but it is caused by not editing the functions template to change localization on your new theme. It will still run fine.

See here, step 5, on changing that.

Regarding the making a new button and that html.

This should work for you and may be easier.

sp_MemberButton('tagClass=spButton spRight&link="racecraftmag.co.uk/?page_id=133/members"&icon="sp_livechat.png" ', __sp('Live Chat'), __sp('Enter the chat room'));

 

That function checks to see if the user can view the members list so your button would only be shown if they can.

You may want to create a completely new button that way you can customize further or use the same function and have buttons that can be placed anywhere in the forum.

You could create a new function in your theme's spFunctions.php (in /template folder)

Call it any button.

function sp_AnyButton($args='', $label='', $toolTip='') {

# Check if logged in if not don't show.
if (is_user_logged_in() !=  true) return;
    global $sfvars;
    $defs = array('tagId'         => 'spAnyButton',
                  'tagClass'     => 'spButton',
                  'link'         => '../',
                  'icon'         => 'sp_AnyButton.png',
                  'iconClass'    => 'spIcon',
                  'echo'        => 1,
                  );
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_AnyButton_args', $a);
    extract($a, EXTR_SKIP);

    # sanitize before use
    $tagId        = esc_attr($tagId);
    $tagClass    = esc_attr($tagClass);
    $link        = esc_url($link);
    $icon        = sanitize_file_name($icon);
    $iconClass     = esc_attr($iconClass);
    $toolTip    = esc_attr($toolTip);
    $echo        = (int) $echo;

    $out = "<a class='$tagClass vtip' id='$tagId' title='$toolTip' href='$link'>";
    if (!empty($icon)) $out.= "<img class='$iconClass' src='".SPTHEMEICONSURL.$icon."' alt=''/>";
    if (!empty($label)) $out.= sp_filter_title_display($label);
    $out.= '</a>';
    $out = apply_filters('sph_AnyButton', $out, $a);

    if ($echo) {
        echo $out;
    } else {
        return $out;
    }

Then put this where you want it.

sp_AnyButton('tagClass=spButton spRight&link="PageToGoTo" ', __sp('Any Button'), __sp('Any Button Text'));

Avatar
Monkfish
London, England
Member
Free Members
sp_UserOfflineSmall Offline
Feb 23, 2012 - 4:39 pm

Hey Brandon - thank you for the information.

The localisation worked, and the first snippet of code works like a dream - but second addition of "any button" doesn't work.

 

I added the code as you pointed out - changed the references of "Any Button" to the correct term and uploaded, but got a syntax error.

I then re-checked, and after pasting the code into the functions file again - it is giving me a syntax error on line 68 - at the end of the page.

This is don't understand, as it is saying the close tag - ?> - is incorrect, but that was in the page to begin with.

Any ideas ?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 23, 2012 - 5:23 pm

the routine is missing the closing }...

Add it before the ?>

Avatar
Monkfish
London, England
Member
Free Members
sp_UserOfflineSmall Offline
Feb 24, 2012 - 9:54 am

Awesome. Thanks papa - I shall ad that into my theme 🙂

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 24, 2012 - 12:06 pm

np. glad to help!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625