News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Simple Portal

Started by samimikawi, March 13, 2017, 05:08:16 AM

Previous topic - Next topic

samimikawi

i put this in php custom

global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings;

if (!$user_info['is_guest']) {
echo '<a href="', $scripturl, '?action=profile;area=notification;">Topics - You\'re Watching</a><br />';
echo '<a href="', $scripturl, '?action=bookmarks">Topics - You\'ve Bookmarked</a><br />';

echo '<hr>';


// Get the user online list.
require_once($sourcedir . '/Subs-MembersOnline.php');
$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$context += getMembersOnlineStats($membersOnlineOptions);

// "Users online" - in order of activity.
echo ' <a href="' . $scripturl . '?action=who">Who\'s Online</a><br />';
echo '
<div class="infocenter_section">
<div class="windowbg">
<div>
', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'],' ', '(' . $context['num_users_hidden'], ' ', $context['num_users_hidden'] == 1 ? $txt['hidden'] : $txt['hidden'], ')';

// Handle hidden users and buddies.
$bracketList = array();
if ($context['show_buddies'])
$bracketList[] = $context['num_buddies'] . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
if (!empty($context['num_spiders']))
$bracketList[] = $context['num_spiders'] . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
//if (!empty($context['num_users_hidden']))
//$bracketList[] = $context['num_users_hidden'] . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo ' (' . implode(', ', $bracketList) . ')';

echo $context['show_who'] ? '</a>': '', '
<div class="smalltext">';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

echo '
</div>
<hr />
<div class="smalltext">';

// Showing membergroups?

$context['membergroups'] = cache_quick_get('membergroup_list', 'Subs-Membergroups.php', 'cache_getMembergroupList', array());

if (!empty($settings['show_group_key']) && !empty($context['membergroups']))

echo '

[' . implode('][', $context['membergroups']) . ']';

}

echo '
</div>
<hr />
<div class="smalltext">
', $txt['most_online_today'], ': <b>', $modSettings['mostOnlineToday'], '</b>.
', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
</div>
</div>
</div>
</div>';
echo '<hr>';

}

// Admin only
if ($user_info['is_admin']) {
echo '<a href="', $scripturl , '?action=admin;area=viewmembers;sa=browse;type=activate', '">', sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), '</a><br />';
}


on preview it shows what i need and it is working but when i add it , it gives me an error

Syntax error in block code. Please check the code.

any idea guys ?

Shambles

You may need to globalise $user_info. Plus, some of your $context keys ('show_who', 'show_buddies') may not be available in your block.

samimikawi

is there a way to fix it ?

samimikawi

i globalize userinfo and still facing problem also i added some new things but still i m receiving the same error please help

<?php
global $txt$modSettings$scripturl$context$sourcedir$settings$user_info$awaiting_activation;

if (!
$user_info['is_guest']) {
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=last">Topics - Last 50 </a><br />';
//echo '<a href="', $scripturl, '?action=dxrecent;style=full;type=hours">Topics - Last 24 hrs</a><br />';
echo 'Topics - Last 50 (disabled)<br />';
echo 
'Topics - Last 24hrs (disabled)<br />';
echo 
'<a href="'$scripturl'?action=profile;area=notification;">Topics - You\'re Watching</a><br />';
echo 
'<a href="'$scripturl'?action=bookmarks">Topics - You\'ve Bookmarked</a><br />';

echo 
'<hr>';

// Get the user online list.
require_once($sourcedir '/Subs-MembersOnline.php');
$membersOnlineOptions = array(
'show_hidden' => allowedTo('moderate_forum'),
'sort' => 'log_time',
'reverse_sort' => true,
);
$context += getMembersOnlineStats($membersOnlineOptions);

// "Users online" - in order of activity.
echo ' <a href="' $scripturl '?action=who">Who\'s Online</a><br />';
echo 
'
<div class="infocenter_section">
<div class="windowbg">
<div>
'
$context['num_guests'], ' '$context['num_guests'] == $txt['guest'] : $txt['guests'], ', ' $context['num_users_online'], ' '$context['num_users_online'] == $txt['user'] : $txt['users'],' ''(' $context['num_users_hidden'], ' '$context['num_users_hidden'] == $txt['hidden'] : $txt['hidden'], ')';

// Handle hidden users and buddies.
$bracketList = array();
if (
$context['show_buddies'])
$bracketList[] = $context['num_buddies'] . ' ' . ($context['num_buddies'] == $txt['buddy'] : $txt['buddies']);
if (!empty(
$context['num_spiders']))
$bracketList[] = $context['num_spiders'] . ' ' . ($context['num_spiders'] == $txt['spider'] : $txt['spiders']);
//if (!empty($context['num_users_hidden']))
//$bracketList[] = $context['num_users_hidden'] . ' ' . $txt['hidden'];

if (!empty($bracketList))
echo 
' (' implode(', '$bracketList) . ')';

echo 
$context['show_who'] ? '</a>''''
<div class="smalltext">'
;

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo 
'
'
sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />'implode(', '$context['list_users_online']);

echo 
'
</div>
<hr />
<div class="smalltext">'
;

// Showing membergroups?

$context['membergroups'] = cache_quick_get('membergroup_list''Subs-Membergroups.php''cache_getMembergroupList', array());

if (!empty(
$settings['show_group_key']) && !empty($context['membergroups']))

echo '

[' 
implode(']['$context['membergroups']) . ']';

}

echo 
'
</div>
<hr />
<div class="smalltext">
'
$txt['most_online_today'], ': <b>'$modSettings['mostOnlineToday'], '</b>.
'
$txt['most_online_ever'], ': '$modSettings['mostOnline'], ' (' timeformat($modSettings['mostDate']), ')
</div>
</div>
</div>
</div>'
;
echo 
'<hr>';

}

// Admin only
if ($context['user']['is_admin']){
// Title
echo'
<div style="text-align:center; color:#FF9900; font-weight:bold;">Members Waiting Act.</div>
<hr />'
;

// Code ;)
global $smcFunc$scripturl$txt;

$request $smcFunc['db_query']('','
SELECT id_member, real_name, date_registered
FROM {db_prefix}members
WHERE is_activated = {int:is_activated}
ORDER BY id_member DESC'
,
array(
'is_activated' => 0,
)
);
$activations = array();
while ($row $smcFunc['db_fetch_assoc']($request)) 
{
$activations[] = array(
'link' => '<a href="' $scripturl '?action=profile;u=' $row['id_member'] . '">' $row['real_name'] . '</a>',
'date' => timeformat($row['date_registered'], '%d %b %y'),
);
}
$smcFunc['db_free_result']($request);

if (empty($activations))
{
echo '
'
$txt['error_sp_no_members_found'];
return;
}

echo '
<ul class="sp_list">'
;

foreach ($activations as $activation)
echo '
<li>'
sp_embed_image('dot'), ' '$activation['link'], ' - '$activation['date'], '</li>';

echo '
</ul>'
;

}

samimikawi

yep i solved the issue , you only need to go to ( Admin - Feature and Options - SimplePortal - Configuration - General Setting - and check  Disable PHP Validation )

everything is fine but it must show the groups list but it doesn't show . any help

Shambles

You've also got too many semicolons in your global declaration:

global $txt, $modSettings, $scripturl, $context, $sourcedir, $settings; $user_info; $awaiting_activation;

samimikawi


Shambles


samimikawi

this block it must be showing the members groups list like ( Administrators , Globalmoderators , Moderators ) but it dosen't do it , can fix it to make it work .

thanks

Shambles

Do you have your forum set to show the group key (ie, $settings['show_group_key'])

If not, your groups won't show in your block. To force the display, remove the conditional

Code (Remove) Select
if (!empty($settings['show_group_key']) && !empty($context['membergroups']))

samimikawi

Perfect it showing now what i requested,  but it doesn't show the additional groups i create it.

Shambles

I'm guessing you're not getting postcount-based groups?

I've no idea whether "cache_quick_get('membergroup_list'..." retrieves postcount-based groups. You'll have to experiment.

samimikawi

it fixed , only when i put the color coding in the group modification it shows but it dosen't show the group by ID it showing them by alphabetical
example:

[Administrator][Founder][Gold Member][Member][Moderator][Power User]

but i want them to be align by ID example:

[Founder][Administrator][Moderator][Gold Member][Power User][Member]

Advertisement: