SMF 2.1.3 has been released! Take it for a spin! Read more.

Main Menu

Custom Action Mod

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

Previous topic - Next topic


I see. Thank you. So the same thing will work in SMF 2.0 beta?
Could maybe this be modified to work in SMF 1.1.4 or not?
QuoteIf you are dying for a solution it may be wise to seek medical attention.
Get some Awesome Smileys for your forum



I guess you could do something like after this in CustomAction.php:
$context['page_title'] = $title;
Adding this:

if ($context['current_action'] == 'News')
$context['html_headers'] .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="" />
<link rel="stylesheet" href="styles.css" type="text/css" />
<script type="text/javascript" src="highslide/highslide.packed.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';

And putting the rest of your script (everything from <body> to </body>) in the code box in the admin panel.

SMF Developer
My Mods
Please do not PM me for support.


Quote from: winrules on March 29, 2008, 04:01:37 PM
Make sure you have the link right like this:

<a href="', $scripturl, '?action=News">News</a>

Thank you winrules - I really appreciate all your help on this and other issues I've had.  I double checked and, yes, I had the right code for the link. 

Meanwhile, I installed the Website Button Mod and it links to the url for the page I created using the Custom Action Mod.  I think I'll stay with that solution for now.


I'm using 3.0 with SMF 2.0 beta. Other CAM pages work as expected but now I'm trying to experiment with ssi_recentPosts and cannot get it to work.

Page type is PHP

Source File Code block is only:
require(dirname(__FILE__) . '/SSI.php');

Template Code is only:

I tried adding echo before the ssi_recentPosts call but that didn't help.

Any suggestions on this?


Do you get any errors or is it just that nothing shows up?

SMF Developer
My Mods
Please do not PM me for support.


if I put echo before the function I get a blank page; otherwise my normal templates print (to the screen) right to the point where the CAM template kick in, then there is no more HTML.


In the source file code put this instead:

global $boarddir;
require($boarddir . '/SSI.php');

Since the file that is executing that code is actually in the sources directory __FILE__ will be in the sources directory. So "(dirname(__FILE__) . '/SSI.php')" would look for SSI.php in the sources directory instead of the board directory where it really is.

SMF Developer
My Mods
Please do not PM me for support.



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



Here's what I need but I don't know how to get it:

When someone puts [player]player name[/player] I need to have it search my database for player name, then find the player ID number and make the [player]player name[/player] a link
[url= ID]player name[/url]

id=player ID should be whatever the player ID is.

Can someone help me figure out how to do this?


Quote from: worm82075 on March 17, 2008, 08:47:48 AM
Awesome Mod, works like a charm, so I have no problem with it's function, my question is about it's use.

Ok, I have archived another site and what I'm working with is about 370 static html pages with css formating. I can see the ability to add the existing code to custom actions editing all links to point to those actions there by integrating the static set into my 1.1.4 SMF forum and it acting as it did before accept it will be surrounded by my header and footer. Ok, that is nearly perfect except I don't want to let guests have access to those actions. From what I've gathered from this thread is that making the action Php rather than Html will give me the ability to put a user check in every action. While I am fairly proficient with html I am not very familiar with  Php as of yet. I have a deadline to meet on the construction of my site otherwise I would just be learning Php and doing this on my own.

My question is this, Is it possible for me to create the action as php, giving me my user check and then have it parse Html code to construct the page. Or alternatively is there a program available that can convert my html code to php.

Any help concerning the possession and regulation of standard html code by SMF would be appreciated. From what I gathered so far in the past 24 hours scouring this site for anything related to this subject is all the solutions in involve transforming my html code to php. Alright well there you have it, I'm sure someone here can enlighten me as to all my options so I can then decide what the best course of action will be.

Jeremy aka Worm

EDIT:I have located a program to convert my html to php and it works!

So all I really need now is a snipet to place at the beginning of my code to dis allow guests.

EDIT 2:ok, I managed to scrounge the first part and it works right
if ($context['user']['is_guest'])
echo "You <FONT color=#ff0000><b>MUST</b></FONT> be a registered member of this site to enter this archive.<BR><BR><BR>";

i just need to be able to kill it at this point if guest checks true

EDIT 3: Well that didn't take much time
if ($context['user']['is_guest'])
die('Direct Access to this location is not allowed.');

I have been at this site at least a half a dozen times for help. This is the first time I actually posted thinking what i needed wasn't here. Just took me a little longer to find it this time thats all. Leave it to a bunch of forum creators to set the example of how to run a tight ship. Thanks

Your post helped me a lot, thank you for all your hard work tracking this info down and posting it in this thread...Well done.


Quote from: NIBOGO on April 19, 2008, 07:36:02 PM
i try a simple php code and nothing appear in the action , what i can do?
Can you post the code you used here?

SMF Developer
My Mods
Please do not PM me for support.

H3 Skillz

Hi, I scimmed through the entire topic and couldn't find the answer to this question so I'm going to ask it, if it's already been answered, I appoligize:

Where are the custom actions stored?  That is, when I create a custom action, I know how to view it and everything.  However, right now, my site is getting huge parse errors everywhere (I think it is because of my host) so I am going to move to a different host that doesn't mess with your files.  Unfortunately, right now I can't login or anything because of the errors so is there a place in the MySQL database where I can find all of the code for all of the custom actions I had?  I had a lot of custom actions and it would take days to restore all of them so where is this data located?  Thanks in advance!


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.

SMF Developer
My Mods
Please do not PM me for support.

H3 Skillz

Cool, I found it, sorry for forgetting to say my version number (which is 1.1.4 which may be needed for my next question)  I have one more question.  I noticed that often times when you try to "restore" a forum (not restore the entire database but just restore the users or all of the posts or some other aspect, it doesn't really work all the time.  For example, when you recover the smf_members table, glitches pop up in the total number of members and everything until you change the most recent member id.  Will this same kind of effect happen when I recover all of the custom actions related variables and values from my smf_settings table?  That is, if I back up all of those custom actions now (by just backing up the variable and value for the title, code, name, and type of each), is there anything in another table (or somewhere else in smf_settings) that I have to backup as well for it to work correctly on a totally new installation when I restore it?


Is there a way to allow specific members to edit this section as well>? Also, how do you stop the center block for tinyportal from showing in the custom actions?


I currently have SMF 2.0 beta 3.0 installed, with the mod installed on it.

Can I update my SMF 2.0 Beta 3 forum to SMF 2.0 Beta 3.1 and will the Mod work??

many thanks, and a great mod!
Best regards,


when i make a php page then go to the page i get the following error...
Parse error: syntax error, unexpected $end in /home/sites/ : eval()'d code(9) : eval()'d code on line 1



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.