• Welcome to Simple Machines Community Forum. Please login or sign up.
January 16, 2022, 05:09:18 AM

News:

Join the Facebook Fan Page.


Custom Action Mod

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

Previous topic - Next topic

PrizeLive.com

Does this work for version 1.1.4?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Marook

SMF Rulez ;) | Meet me home ! | My Mods

tsmalmbe

Can I give permission to certain users/groups to use this, or is it only for administrators?
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

tsmalmbe

If  I  make an action using PHP, what do I need to do to get mysql-queries to work?
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Marook

No you can't give permissions, but can verify the membergroup in your custom action code... you can use db_query() to do sql queries, pls refer to the online documentation.
SMF Rulez ;) | Meet me home ! | My Mods

tsmalmbe

Yes I realized that I can perform mysql-queries just as normal. Although, it behaves a little wierd, it does work. How about getting parameters,  there's no convenience-array I could use, I will have to parse the request directly, right?

Oh, regarding the mysql-queries. I now initialize a new connection. I copied that part directly from the SSI.php. But is this necessary? Initializing a conn  requires  me to put usernams and passwords  in my custom action, which is not nice.

..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Marook

No you dont need to initialize a new connection, just do the queries... just take a look at the docs
SMF Rulez ;) | Meet me home ! | My Mods

tsmalmbe

Well... really, finding out what I can and cannot do with Custom Actions is not really revealed in the docs. What you are trying to say is, it is business as usual, right? I can call any functions declared in subs (as long as they subs are included that is), do any sql:ing, and so forth.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Marook

Yepp ;) Maybe sometimes you must use global [$varname] to get access to different vars... for example, i used the $language variable, which is stored in $_SESSION['language'] to display different parts of my custom actions in the same language, the user or guest has choosed... Its also possible to display the linktree above your custom action... SMF is great !!!
SMF Rulez ;) | Meet me home ! | My Mods

ibizara

Hi,

Please could someone give me some guidance on how to do the below code with a db_query() ??

Many Thanks,
ibizara

<?php
require_once('SSI.php');

$allowed_groups = array(19);
$can_see FALSE;
foreach (
$allowed_groups as $allowed)

if (
in_array($allowed$user_info['groups'])){
$can_see TRUE;
break;
}

if (
$can_see){
echo (
'access granted');
}

else{
echo (
'access denied');
}

?>

falguni1

December 14, 2007, 06:45:51 AM #270 Last Edit: December 14, 2007, 06:48:38 AM by falguni1
I want to create a php action

if user is logged in
then show his own post

how to write the code I dont know wot code is needed to get this action

digit

hmm, I don't think you can set permissions with this mod -  unfortunately!  ;)
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!)

falguni1

ok

as we have the mod we want some php snippets to use

so can anyone create some snippets or ideas to be used in this mod.

digit

Using the customaction mod, is there a way to do this?



<a href="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=showPosts"><img border="0" src="',$settings['images_url'],'/usercp/kedit.png" width="80" height="80"></a>



If I try JUST that I get the error....

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

Is it possible to get the smf variables?

Thanks in advance.

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!)

ibizara

Whenever I got¬
Parse error: syntax error, unexpected '<' in /Sources/Load.php(1748) : eval()'d code(9) : eval()'d code on line 1

I just created everything on a seprate page and seems to work better...

include_once("./custom/index.php");

falguni1

Quote from: ibizara on December 17, 2007, 08:57:47 AM
Whenever I got¬
Parse error: syntax error, unexpected '<' in /Sources/Load.php(1748) : eval()'d code(9) : eval()'d code on line 1

I just created everything on a seprate page and seems to work better...

include_once("./custom/index.php");

wot is the complete code you are using can u please give us.

ibizara

December 18, 2007, 07:24:28 AM #276 Last Edit: December 18, 2007, 07:29:34 AM by ibizara
That is all the code... just include a page rather than put code into the custom textarea.
I found it works alot better and gets rid of the error you had below (or it did for me anyway).

s1.png Custom Action Code
s2.png /custom/top.php
s3.png /custom/index.php

(s4.png - My setup with a submenu)

falguni1

can some one give post some php snippets to use with mod.

avepeachy

I've used this mod with some success on my site. The problem is that the pages only show up in Firefox. None of my members viewing in IE can see the html pages. Is anyone else having this problem? WOuld someone be willing to help me try and fix this?

Thanks in advance!

ibizara

January 24, 2008, 11:03:36 AM #279 Last Edit: January 24, 2008, 11:05:07 AM by ibizara
Just different ways to link external pages...

include("./custom/link.php");
echo'<IFRAME width=100% marginwidth=0 marginheight=0 frameborder=0 SRC="/custom/link.html"></IFRAME>';

Quote from: falguni1 on December 21, 2007, 05:57:43 AM
can some one give post some php snippets to use with mod.

Advertisement: