Author |
Message |
kevinkap
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Apr 22, 2006
Posts: 356
|
Posted:
Sat Oct 27, 2007 7:00 pm |
|
running rn2.10.01 with cnbya4.4.2 modified by fade2gray from here. I have found the code that is missing in the cnbya file that will make it show any subscriptions you have but cannot get it to work.
Mod please move if you feel it would be better in another thread.
I have compared the code, here is the section that the cnbya file is missing.
Code:
echo _USERSTATUS.': <b>'.$online.'</b><br />'."\n";
if (($userinfo['newsletter'] == 1) AND (isset($cookie[1]) AND $username == $cookie[1]) AND (isset($cookie[2]) AND $userinfo['user_password'] == $cookie[2]) OR (is_admin($admin) AND ($userinfo['newsletter'] == 1))) {
echo '<i>'._SUBSCRIBED.'</i><br />';
} elseif (isset($cookie[1]) AND ($userinfo['newsletter'] == 0) AND ($username == $cookie[1]) AND (isset($cookie[2]) AND $userinfo['user_password'] == $cookie[2]) OR (is_admin($admin) AND ($userinfo['newsletter'] == 0))) {
echo '<i>'._NOTSUBSCRIBED.'</i><br />';
}
if (is_user($user) AND $cookie[1] == "$username" OR is_admin($admin)) {
$numpoints = $db->sql_fetchrow($db->sql_query('SELECT points FROM '.$user_prefix.'_users WHERE user_id = \''.intval($cookie[0]).'\''));
$n_points = intval($numpoints['points']);
echo _YOUHAVEPOINTS.' <b>'.$n_points.'</b><br />';
|
Code:
if (paid()) {
$row = $db->sql_fetchrow($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($cookie[0]).'\''));
if (!empty($subscription_url)) {
$content = '<br />'._YOUARE.' <a href="'.$subscription_url.'">'._SUBSCRIBER.'</a> '._OF." $sitename".'<br />';
} else {
$content = '<br />'._YOUARE.' '._SUBSCRIBER.' '._OF." $sitename".'<br />';
}
$diff = $row['subscription_expire']-time();
$yearDiff = floor($diff/60/60/24/365);
$diff -= $yearDiff*60*60*24*365;
if ($yearDiff < 1) {
$diff = $row['subscription_expire']-time();
}
$daysDiff = floor($diff/60/60/24);
$diff -= $daysDiff*60*60*24;
$hrsDiff = floor($diff/60/60);
$diff -= $hrsDiff*60*60;
$minsDiff = floor($diff/60);
$diff -= $minsDiff*60;
$secsDiff = $diff;
if ($yearDiff < 1) {
$rest = $daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff == 1) {
$rest = $yearDiff.' '._SBYEAR.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff > 1) {
$rest = $yearDiff.' '._SBYEARS.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
}
$content .= '<b>'._SUBEXPIREIN.'</b><br /><font color="#FF0000"><b>'.$rest.'</b></font>';
} else {
if (!empty($subscription_url)) {
$content .= '<br />'._NOTSUB." $sitename. "._SUBFROM.' <a href="'.$subscription_url.'">'._HERE.'</a> '._NOW;
} else {
$content .= '<br />'._NOTSUB." $sitename.";
}
}
echo "$content".'<br /><br />';
if (is_admin($admin)) {
$subnum = $db->sql_numrows($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($userinfo['user_id']).'\''));
if ($subnum != 0) {
echo '<b>'._ADMSUB.'</b><br />';
$row = $db->sql_fetchrow($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($userinfo['user_id']).'\''));
$diff = $row['subscription_expire']-time();
$yearDiff = floor($diff/60/60/24/365);
$diff -= $yearDiff*60*60*24*365;
if ($yearDiff < 1) {
$diff = $row['subscription_expire']-time();
}
$daysDiff = floor($diff/60/60/24);
$diff -= $daysDiff*60*60*24;
$hrsDiff = floor($diff/60/60);
$diff -= $hrsDiff*60*60;
$minsDiff = floor($diff/60);
$diff -= $minsDiff*60;
$secsDiff = $diff;
if ($yearDiff < 1) {
$rest = $daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff == 1) {
$rest = $yearDiff.' '._SBYEAR.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff > 1) {
$rest = $yearDiff.' '._SBYEARS.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
}
$content = '<b>'._ADMSUBEXPIREIN.'</b><br /><font color="#FF0000"><b>'.$rest.'</b></font><br /><br />';
echo "$content";
} else {
echo '<b>'._ADMNOTSUB.'</b><br /><br />';
}
}
}
|
You can see the points code is a bit different as well.
I believe the code goes after this:
Code:
if (is_user($user) AND $cookie[1] == "$username" OR is_admin($admin)) {
echo "<tr>\n<td width='30%' bgcolor='$bgcolor1'>"._YA_POINTS."</td>\n<td width='70%' bgcolor='$bgcolor1'><b>$usrinfo[points]</b></td>\n</tr>\n";
}
}
if (($usrinfo[newsletter] == 1) AND ($username == $cookie[1]) AND ($usrinfo[user_password] == $cookie[2]) OR (is_admin($admin) AND ($usrinfo[newsletter] == 1))) {
echo "<tr>\n<td width='30%' bgcolor='$bgcolor1'>"._NEWSLETTER."</td>\n<td width='70%' bgcolor='$bgcolor1'><b>"._SUBSCRIBED."</b></td>\n</tr>\n";
} elseif (($usrinfo[newsletter] == 0) AND ($username == $cookie[1]) AND ($usrinfo[user_password] == $cookie[2]) OR (is_admin($admin) AND ($usrinfo[newsletter] == 0))) {
echo "<tr>\n<td width='30%' bgcolor='$bgcolor1'>"._NEWSLETTER."</td>\n<td width='70%' bgcolor='$bgcolor1'><b>"._NOTSUBSCRIBED."</b></td>\n</tr>\n";
}
|
I have tried putting it in there but get a white page after I do. Any help is as always much appreciated ![Wink](modules/Forums/images/smiles/icon_wink.gif) |
_________________ Kevin Kappes |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kevinkap
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Oct 27, 2007 7:53 pm |
|
ok, I have figured it out. If anyone is using rn2.10.01 and cnbya4.4.2 you will need to make the following changes to the ya/public/userinfo.php file for it to show your subscriptions, points and group memberships.
After this on line 119
Code:echo "<tr>\n<td width='30%' bgcolor='$bgcolor1'>"._YA_POINTS."</td>\n<td width='70%' bgcolor='$bgcolor1'><b>$usrinfo[points]</b></td>\n</tr>\n";
|
remove everything down to this:
Code:echo "</table>\n";
echo "</center><br>\n<center>\n";
if (is_active("Journal") AND $cookie[1] != $username) {
|
now add this after line 119:
Code: }
}
if (($userinfo['newsletter'] == 1) AND (isset($cookie[1]) AND $username == $cookie[1]) AND (isset($cookie[2]) AND $userinfo['user_password'] == $cookie[2]) OR (is_admin($admin) AND ($userinfo['newsletter'] == 1))) {
echo '<i>'._SUBSCRIBED.'</i><br />';
} elseif (isset($cookie[1]) AND ($userinfo['newsletter'] == 0) AND ($username == $cookie[1]) AND (isset($cookie[2]) AND $userinfo['user_password'] == $cookie[2]) OR (is_admin($admin) AND ($userinfo['newsletter'] == 0))) {
echo '<i>'._NOTSUBSCRIBED.'</i><br />';
}
if (is_user($user) AND $cookie[1] == "$username" OR is_admin($admin)) {
$numpoints = $db->sql_fetchrow($db->sql_query('SELECT points FROM '.$user_prefix.'_users WHERE user_id = \''.intval($cookie[0]).'\''));
$n_points = intval($numpoints['points']);
echo _YOUHAVEPOINTS.' <b>'.$n_points.'</b><br />';
if (paid()) {
$row = $db->sql_fetchrow($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($cookie[0]).'\''));
if (!empty($subscription_url)) {
$content = '<br />'._YOUARE.' <a href="'.$subscription_url.'">'._SUBSCRIBER.'</a> '._OF." $sitename".'<br />';
} else {
$content = '<br />'._YOUARE.' '._SUBSCRIBER.' '._OF." $sitename".'<br />';
}
$diff = $row['subscription_expire']-time();
$yearDiff = floor($diff/60/60/24/365);
$diff -= $yearDiff*60*60*24*365;
if ($yearDiff < 1) {
$diff = $row['subscription_expire']-time();
}
$daysDiff = floor($diff/60/60/24);
$diff -= $daysDiff*60*60*24;
$hrsDiff = floor($diff/60/60);
$diff -= $hrsDiff*60*60;
$minsDiff = floor($diff/60);
$diff -= $minsDiff*60;
$secsDiff = $diff;
if ($yearDiff < 1) {
$rest = $daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff == 1) {
$rest = $yearDiff.' '._SBYEAR.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff > 1) {
$rest = $yearDiff.' '._SBYEARS.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
}
$content .= '<b>'._SUBEXPIREIN.'</b><br /><font color="#FF0000"><b>'.$rest.'</b></font>';
} else {
if (!empty($subscription_url)) {
$content .= '<br />'._NOTSUB." $sitename. "._SUBFROM.' <a href="'.$subscription_url.'">'._HERE.'</a> '._NOW;
} else {
$content .= '<br />'._NOTSUB." $sitename.";
}
}
echo "$content".'<br /><br />';
if (is_admin($admin)) {
$subnum = $db->sql_numrows($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($userinfo['user_id']).'\''));
if ($subnum != 0) {
echo '<b>'._ADMSUB.'</b><br />';
$row = $db->sql_fetchrow($db->sql_query('SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.intval($userinfo['user_id']).'\''));
$diff = $row['subscription_expire']-time();
$yearDiff = floor($diff/60/60/24/365);
$diff -= $yearDiff*60*60*24*365;
if ($yearDiff < 1) {
$diff = $row['subscription_expire']-time();
}
$daysDiff = floor($diff/60/60/24);
$diff -= $daysDiff*60*60*24;
$hrsDiff = floor($diff/60/60);
$diff -= $hrsDiff*60*60;
$minsDiff = floor($diff/60);
$diff -= $minsDiff*60;
$secsDiff = $diff;
if ($yearDiff < 1) {
$rest = $daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff == 1) {
$rest = $yearDiff.' '._SBYEAR.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
} elseif ($yearDiff > 1) {
$rest = $yearDiff.' '._SBYEARS.', '.$daysDiff.' '._SBDAYS.', '.$hrsDiff.' '._SBHOURS.', '.$minsDiff.' '._SBMINUTES.', '.$secsDiff.' '._SBSECONDS;
}
$content = '<b>'._ADMSUBEXPIREIN.'</b><br /><font color="#FF0000"><b>'.$rest.'</b></font><br /><br />';
echo "$content";
} else {
echo '<b>'._ADMNOTSUB.'</b><br /><br />';
}
}
}
|
Then after the "close table" around line 225:
Code: if (((is_user($user) AND $cookie[1] != $username) OR is_admin($admin)) AND is_active("Private_Messages")) { echo "<br>[ <a href=\"messages-.html$usrinfo[user_id]\">"._USENDPRIVATEMSG." $usrinfo[username]</a> ]<br>\n"; }
echo "</center></font>";
} else {
echo "<center>"._NOINFOFOR." $username</center>";
}
CloseTable();
|
you will need to add this code:
Code: //2006-03-09 montego: fix so group memberships only show to the logged in user and admin br#0000005
if ((is_user($user) AND $cookie[1] == $username) OR is_admin($admin)) {
// Group Memberships
// Add these to your Your_Account lang files:
//define('_MEMBERGROUPS','Group Memberships');
//define('_EXPIRES','expires');
//define('_NOTSET','non-expiring');
$result11 = $db->sql_query('SELECT gid, edate FROM '.$prefix.'_nsngr_users WHERE uid=\''.$userinfo['user_id'].'\' ORDER BY gid');
if (($db->sql_numrows($result11) > 0)) {
if($userinfo['user_dateformat']=='') { $userinfo['user_dateformat'] = grget_config(date_format); }
echo '<br />';
OpenTable();
echo '<b>'.$userinfo['username'].'\'s '._MEMBERGROUPS.':</b><br />'."\n";
echo '<ul>';
while(list($gid, $edate) = $db->sql_fetchrow($result11)) {
list($gname) = $db->sql_fetchrow($db->sql_query('SELECT gname FROM '.$prefix.'_nsngr_groups WHERE gid=\''.intval($gid).'\''));
echo '<li>'."$gname";
if (is_admin($admin)) { echo " ($gid)"; }
if ($edate != '') {
if ($edate != 0) {
echo ' - <i>'._EXPIRES.' '.date($userinfo['user_dateformat'], $edate).'</i>';
} else {
echo ' - <i>'._NOTSET.'</i>';
}
}
echo '</li>'."\n";
}
echo '</ul>';
CloseTable();
}
}
|
Now I am sure this post probably needs to be moved but I hope it helps someone. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Oct 27, 2007 9:18 pm |
|
I have made it a sticky. It may need to be moved to CNBYA forum (or copied), but lets see what the "reaction" is to your thread from the community... |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|