News:

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

Mick.

Dang, I've been using this mod since forever and just realized when guests see these custom action pages, it shows "unknown action" in who's online.

I guess I'll try to figure out how to fix this so it shows the page name instead.

Chalky

Hello again  ;)

The Action Name is used to identify the action from the list of actions created.
The Action URL is where you get to choose the URL of your new page, so if you put privacy in that field, the new page will be found at yoursite.com/index.php?action=privacy, for example.

The HTML Body is where you create your page.  Try some of the html you have already prepared for your page maybe, but without the <html> tags.  You may need to play with it to make it appear as you want.

As for the HTML Headers, we'll need someone who knows more than I to explain that one - I just left it blank  :P

andershz

I have made a few enhancements to this mod for my own use.
I has occurred to me that perhaps someone else might benefit from this.
Before packaging everything up properly and conferring with the mod author about the best way forward I want to check if there is any interest among the mod users, otherwise it's just unnecessary work.

Bug fixes

  • Including a </textarea> tag in block would mess up the editor.
  • Using the same url parameter for a top level action and a sub action, (of any top level action), or for several sub actions of different top level actions could lead to the wrong action being executed.
  • The same url parameter could be entered for several top level actions or several sub actions of the same top level action.
  • The alternate row styling in the action list did not extend to the "Enabled" and "Modify" columns.
New features

  • Optional menu buttons also for sub actions, (selectable per sub action).
  • A new sub action type, "None".
    Such a sub action will not have any code of its own, instead the parent action is executed with an extra ";sa=subaction" parameter.
    The same thing would happen if the sub action wasn't defined at all, the difference being that a sub action can have a menu button and its own set of permissions, different from the parent action.
  • PHP and HTML blocks are edited using Codemirror instead of in a plain textarea.
    This brings benefits such as:
    *Syntax colouring
    *Automatic indentation
    *Brace matching
    *Full screen mode
  • Menu buttons for custom actions now appear just before the Login/Logout button, not at the end of the menu.
  • The link tree is automatically populated, (can be overridden in PHP actions).
  • The Who's Online page shows the action name instead of "Unknown action", (depending on permissions).
    Can be overridden by language strings in the Who.*.php files.
  • The action name, (used in menu button text, page title, link tree text and Who's Online), can optionally be translated using standard SMF language strings.
  • Last, and for most people probably also least, added Swedish translation in addition to the existing English and German.
Refactoring

  • Partly converted to use integration hooks.
  • Language strings moved to separate files for utf8 and non-utf8 texts.
    This makes it easier to provide both utf8 and non-utf8 versions also for other languages than English, without having to resort to html entites.
New bugs

  • Probably, but none that I'm aware of.

Gluz

Quote from: andershz on October 20, 2013, 01:11:19 PM
  • Including a </textarea> tag in block would mess up the editor.
How do you solve this?

I have a custom Form that uses some Textareas and cant get this to work properly.

andershz


[yub] Lazo

Is it just me or when I want to change the name of the action I alredy made before the name of the action stays the same in the subs?

Dynamic forum signatures v1.2

vasilios

Hello!
It is possible and how the button of a custom action put near Home button and not last of menu..

vasilios


vasilios

Ok I found the solution :D

asyaavrupa


Gwenwyfar

#610
Nice mod! :D

Quote from: tylerabell on May 16, 2008, 01:12:26 AM
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/forgeguide.com/public_html/Sources/Load.php(1747) : eval()'d code(9) : eval()'d code on line 1
I have the exact same issue... On a fresh install of 2.0.8. The action just has "test" written in it. If I change it to html it works ok.

Different line though:

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\forum\Sources\Load.php(2165) : eval()'d code(20) : eval()'d code on line 1

Edit: Ah, simple matter. Way too simple of a test. Just some random echo works :)

And as a suggestion, it would be nice if you could choose which theme would show the action with by default, like you'd do on a board.
"It is impossible to communicate with one that does not wish to communicate"

Shambles

This mod requires/creates rows in {smf}permissions, named "ca_1" "ca_2" etc.

While diagnosing why my members occasionally lose 'allow' permissions to their Custom Actions I spotted that these rows are being deleted whenever anything is changed within their overall membergroup permissions.

EG, I give my Global Mods permission to use Custom Action 1. Later I go to their membergroup and change their Gallery permission. Upon saving that, their Custom Action permission row (ca_1) has been deleted, meaning they no longer have the permission to use Custom Action 1.

Easy resolution is to revisit the Custom Action feature within Admin > Configuration > Features & Options > Custom Actions and reset it there, though it would be neat if the permissions rows weren't deleted to start with :(


Sakae

Quote from: andershz on October 20, 2013, 01:11:19 PM
I have made a few enhancements to this mod for my own use.
I has occurred to me that perhaps someone else might benefit from this.
Before packaging everything up properly and conferring with the mod author about the best way forward I want to check if there is any interest among the mod users, otherwise it's just unnecessary work.

Well, I'm interested.

Since it's a old post, I'm messaging you.
http://www.tigrelog.com.br
l: simple p: machines

Livaco

Quick question, how do i create a sub-action?

andershz

This is a well hidden feature.
In the table of actions there is a column named Sub-Actions, indicating the number of sub actions (contains zero if there are none).
Click on that number to get to a page where sub actions can be added/modified/deleted.

Livaco


mt

If installed under mariadb, the db installer with fail with an error msg for every " 'default' => '', " entry in the file install.php.

Removing that entries will make it work agian.

skb

I tried creating custom action to update smf_members table. I want to change IP address and used this code
UPDATE  `db_name`.`smf_members` SET  `member_ip` =  'xxx.xxx.xx.xxx',
`member_ip2` =  'yyy.yyy.yy.yyy' WHERE  `smf_members`.`id_member` =n;


Could not accomplish. Should I be doing something differently ? 

SMF 2.1.4 / TP 2.2.2

Arantor

Um, what were you trying to achieve exactly?

skb

Like I said, UPDATE the smf_members table to change IP for one user.

SMF 2.1.4 / TP 2.2.2

Advertisement: