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

RebelRose

Quote from: winrules on October 23, 2006, 04:01:47 PM
That's an error in the code you put in for the page. If you post the code I might be able to help.

The code for the mlist?

winrules



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


RebelRose

Here it is


global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

$groups_list = array(0, 20,14, );


        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-top: 2px solid #003366; border-bottom: 2px solid #003366; padding-top: 4px; "><center><h1>Meet All Our Members!!</h1></center></td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="90%" cellpadding="0" cellspacing="0"><tr>
<td colspan="4" style="border-top: 2px solid #003366; padding-top: 4px; "><h4>' . $groupname . '</h4>
</td></tr><tr><td colspan="4"></td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 2px;">
<h4 style="margin-top: 0; margin-top: 2px;">'.$team['link'].'</h4>
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"></td></tr><tr>';
            }
        }
echo '</tr></table>';
}

winrules

Try this:

if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}
else
$groupname = '';

Instead of

if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


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


RebelRose

ok great thanks, I will go try it and if it stops the errors I want to say thank you now and if not I will be back.

Thanks

RebelRose

Parse error: syntax error, unexpected '}' in /public_html/forum/Sources/Load.php(1711) : eval()'d code(9) : eval()'d code on line 120

LeGaS

Try this:
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}
else {
$groupname = '';
        }

RebelRose

Thank you LeGaS, that worked and so far no errors!!!

lesmond

Great Mod winrules thanks I use it a lot :) Now for the question! can I make a custom action use specific theme i.e if my board is set to use the "SMF Default Theme"  can I make the mod use "Babylon Theme" instead, so that when I have made an action and I link to it that link goes to the "Babylon Theme" with that page.
Hope this makes sense  ???

Thanks Les


Free Forum Image Hosting


The only person who got all his work done by Friday was Robinson Crusoe

winrules

Umm I don't think there's a way to that right now sorry.


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


lesmond

ok  winrules thanks, its just that I have a shop on my site and I have it in a article (TinyPortal), so if people are viewing that page I cant see what they are doing in who's online

Les


Free Forum Image Hosting


The only person who got all his work done by Friday was Robinson Crusoe

oneway

Winrules where does the Custom Action data get stored? Couldn't find a heading for it it in the database, or anywhere else I looked.

I use Custom Action all the time, it's great!

winrules

It's in the settings table.


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


markd

real fast: I see the php code to make sure the visitor is not a guest, but what would be the php code to limit the action to a specific membergroup?

or better yet, specific membergroups, like Groups A & B can't access, but Groups C, D, F, but not E can.

:)

thanx
-markd



winrules


if (!in_array(array(1, 2, 3), $user_info['groups']) || in_array(array(4, 5, 5), $user_info['groups']))
fatal_error('You are not allowed to access this section.', false);

That would only allow the user to access the page if they are in group 1, 2, or 3, and not in groups 4, 5, or 6. Note that those are groups IDs, not names, and $user_info has to be in the global list.


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


Isaac

Would it be possible to make it so the forum menu bar at the top is not displayed on the custom pages?

winrules

Quote from: Isaac on November 22, 2006, 09:42:37 PM
Would it be possible to make it so the forum menu bar at the top is not displayed on the custom pages?
Do you mean the whole header and footer or just the list of buttons at the top?


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


Isaac

Quote from: winrules on November 22, 2006, 10:54:20 PM
Quote from: Isaac on November 22, 2006, 09:42:37 PM
Would it be possible to make it so the forum menu bar at the top is not displayed on the custom pages?
Do you mean the whole header and footer or just the list of buttons at the top?
Just the list of buttons at the top, like [Home] [Search], etc.

winrules

Hmm...that's a hard one. I guess you could do something like edit index.template.php. Find:

template_menu();

Replace With:

if (!in_array( $context['current_action'], array('myaction')))
template_menu();

Just replace 'myaction' with the name of your action. If you have more than one action you can put 'myaction', 'myaction2', 'ect'.


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


Isaac

Works perfectly.  Thanks for the quick response, I really appreciate it.

Advertisement: