Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Custom Action Mod

Started by Norv, May 09, 2006, 08:35:29 PM

Previous topic - Next topic

Marcus Forsberg

Why ain't v3.0 avabile for 1.1.4?   :'( :'( :'(

New Earth

How can I get all the TinyPortal blocks to show up on one of my custom pages?

Thank you.


anyone tested in 1.1.5?

mod site says only for 1.1.4 but because most of the mods then also run in 1.1.5, I tested but always get a parse error in the .xml files  ::)


I have it up in my 1.1.5 forums. works great for me.


now it works

had to upload a new temp file in the packages and then it worked well :D


Just wanted to say a big Thanks! for making this fantastic mod.  ;D

I can't even begin to tell you how much added functionality this has given to my site.

Installed on SMF 1.1.5 - with absolutely no trouble. [nofollow]
Looking for Anime/Manga sites to Affiliate with.
Contact via [nofollow]


Hi,  I am able to make the action just fine but what I need is to have that action listed in the visibility options so that I can place a Tiny Portal Block there by itself. 

i.e.   custom action = "Chat"

Display on all pages and sections
Front page
Show unread
Unread replies
My Messages


Is this possible?

Also, how do I delete the actions menu tab after  deleting an I have to do this manually in index.template?


Can I use this to add a custom action for my coppermine gallery. I want to add an action "gallery" that links to my coppermine index without breaking the action url.


I have installed this mod on version 1.1.5. The install went fine with no errors.

When I go to Features/Custom Actions I get a blank page.


Quote from: winrules on April 23, 2008, 03:24:19 PM
If you are using SMF 1.1 they are stored in the settings table in the database. If you are using SMF 2.0 they are stored in the custom_actions table.

It'd be cool if that were true in 1.1 too.  Any chance of an upgrade? :)  I would hate to somehow crash my settings table. (I'm dealing with a lot of actions)

While I'm tossing things around ;)  I would also like to see - in the admin area....   just a list of actions,  linked to the individual action forms...  instead of having all the actions editable from one big page.

Thanks for a great mod.


Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members

SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)


When i add a php action it shows this error ...

Parse error: syntax error, unexpected '<' in /home/alblove/public_html/forum/Sources/Load.php(1726) : eval()'d code(9) : eval()'d code on line 1

Can someone help me ?



How can I translate this mod?


Hey Winrules.....

In the admin area, where we have the list of actions, how would I add the current custom action name to the html?  I have a lot of actions, and it's hard finding any of them, since I can not search for text in an input box.  I would like to hit control-f and find the actions.

See attachment - notice the text in red....

Thanks again for my favorite mod!    :D
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members

SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)


I have just installed this Mod and when I tried to go in Admin Section following message appeared, 

Fatal error: Cannot redeclare template_show_custom_action() (previously declared in C:\Inetpub\vhosts\\httpdocs\Sources\Load.php(1859) : eval()'d code:1965) in C:\Inetpub\vhosts\\httpdocs\Sources\Load.php(1859) : eval()'d code on line 2106

Forum Name is

Please Tell me How I can Fix this problem 




Very, very good work, WinRules. This is definitely one that I enjoy using, a lot!

There is a modification I'm working on for it that seems to be working well - adding stylesheets that are correctly served as text/css. I did the same thing with my TinyPortal installation several months ago, for blocks and articles. It's a modification to the root index.php (simply adding the css action in), then a new function in CustomAction.php, using the same functions that the .xml action uses to avoid the attempt to find a template. The new function in mine is called CustomActionCSS. This applies only to the SMF 1.1.x installation for this mod and not the SMF 2.0 version. But code is free to give out so here it is! (Be aware that errors may happen if my installation instructions weren't as clear as perhaps they should be lol). :P


Add function to any area of the file, just not before <?php or ?>, or inside another function. That would be bad. Anywhere in between the tags and outside of a function will do.
// Parse this action's stylesheet!!!
function CustomActionCSS()
    global $context, $modSettings;

    if (!empty($modSettings['enableCompressedOutput']))

    header('Content-type: text/css');
    if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'css')
        if(isset($modSettings['CA' . $_REQUEST['style'] . '_css']))
            echo $modSettings['CA' . $_REQUEST['style'] . '_css'];
            echo '';
        if (isset($_REQUEST['substyle']))
            if(!empty($modSettings['CA' . $_REQUEST['style'] . '_sa' . $_REQUEST['substyle'] . '_css']))
                echo $modSettings['CA' . $_REQUEST['style'] . '_sa' . $_REQUEST['substyle'] . '_css'];
                echo '';


        'cleanperms' => array('Admin.php', 'CleanupPermissions'),

        'css' => array('CustomAction.php', 'CustomActionCSS'),


function setupThemeContext()
    global $boarddir, $db_prefix, $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt, $maintenance;

Add Below:
    // Action
    $i = 1;
    while (isset($modSettings['CA' . $i . '_name']))
        // Is this it?
        if ($context['current_action'] == $modSettings['CA' . $i . '_name'])
            if(!empty($modSettings['CA' . $i . '_css']))
                $context['html_headers'] .= "\n\t\t" . '<link rel="stylesheet" type="text/css" href="'.$scripturl.'?action=css;style='.$i.'" />';
    // Subaction
    if (isset($_REQUEST['sa']))
        // A subaction was specified, try to find it.
        $n = 1;
        while (isset($modSettings['CA' . $i . '_sa' . $n . '_name']))
            // Is this it?
            if ($_REQUEST['sa'] == $modSettings['CA' . $i . '_sa' . $n . '_name'])
                if(!empty($modSettings['CA' . $i . '_sa' . $n . '_css']))
                    $context['html_headers'] .= "\n\t\t" . '<link rel="stylesheet" type="text/css" href="'.$scripturl.'?action=css;style='.$i.';substyle='.$n.'" />';

If you use the html_headers variable to store those lines, you may find that stylesheets you write in the custom action config can overwrite values in your normal style.css file. If you find this is the case, create a new variable in css such as $context['html_headers']['css'] or whatever you want to call it, and place that in index.template.php.

About the Load.php problem with template_show_custom_action() - apparently that function is repeated twice, for some reason in your load.php file. It looks like your site is working though right now, far as I can tell.


Hmm.  I can't get this mod to install.  When I click, "Apply mod" it goes to a blank white screen. :O

I'm using SMF 1.1.5 with these mods installed:

1.     AEF Login Fix 1.0
2.    Remove Post Modified Time 1.2
3.    View_Email_Permission 1.0
4.    AJAX Instant Quick Reply 1.0.1
5.    Prevent Adding Signature Images And Links 1.3

Normally when something doesn't work, it brings up a warning screen about a possible conflict - the fact that it just goes straight to a blank screen is concerning. :P



I Love this mode.....BUT ITS DRIVING ME CRAZY

ive made so many custom pages. and when i upload them it seems to go fine, then just goes to a blank white page (which is done loading). After that i get to admin and try click custom actions and all i get is a white page. ITS KILLING ME!!! ive spent months making my site, had this happen, redid it all and its happened again and i cant get back into custom actions to add new pages or edit the old ones

If anyone has the answer to fix this PLEASE, PLEASE, PLEEAAASSEEEE HELP ME!!!!

i dont wanna spend 3 weeks full time trying to make this again

Thanks guys,



also how do i back up my custom mod pages, ive uploaded over 1000 and lose them, then i got to go back and make new page, make the links , link them all again.

Is there a file with them all stored, or some sort of table i have to download (i have no idea how to do this by the way)


Quote from: Atheo on May 16, 2008, 01:45:37 PM

OK.  I'm not sure if this is a question for this topic or not but I have to ask.  I am able to use the mod fine.  What I want to do, though, is to change the 'home' button so that it links to my custom page.  I am using smf 2.

Please help.


Just a follow up in this question, and I ain't using SMF 2.0

Anybody have a clue?

I tried putting CustomAction.php as the required file when the command is empty in index.php but I cannot get it to choose a certain command so it loads up blank

Also I'm thinking of using the site integration mod but apparently the pages made here are stored in the database instead of a separate php file...

so any help, idea or clue would be fine...
[For Hire] I can help you with anything regarding Simple Machines Forum and TinyPortal  ~ My Portfolio


ok, i actually found out how to do what i asked and what Atheo asked

First open: $boarddir/index.php


      if (empty($board) && empty($topic))
         require_once($sourcedir . '/BoardIndex.php');
         return 'BoardIndex';

Replace by:

      if (empty($board) && empty($topic))
         require_once($sourcedir . '/CustomAction.php');
         return 'CustomAction';

Second open: $sourcedir/CustomAction.php


// Is this it?
if ($context['current_action'] == $modSettings['CA' . $i . '_name'])
// Set $type, $title and $code, which will later be put into the $context variable.
$type = $modSettings['CA' . $i . '_type'];
$title = $modSettings['CA' . $i . '_title'];
$code = $modSettings['CA' . $i . '_code'];
// No need to continue.


elseif ($context['current_action'] == '')
// Set $type, $title and $code, which will later be put into the $context variable.
$type = $modSettings['CA' . '1' . '_type'];
$title = $modSettings['CA' . '1' . '_title'];
$code = $modSettings['CA' . '1' . '_code'];
// No need to continue.

IMPORTANT  NOTE: The number 1 at the above code represents the first custom action you have in the list of custom action pages you made. Change the number accordingly depending on what number the page you want counting from top to bottom.
[For Hire] I can help you with anything regarding Simple Machines Forum and TinyPortal  ~ My Portfolio