User status based on number of posts
Posted by Mandingo
Re: User status based on number of posts July 30, 2004 06:00PM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: User status based on number of posts July 31, 2004 04:23AM |
Registered: 21 years ago Posts: 109 |
Right. Now we've got -
hook: read|phorum_mod_status
title: Status Module
desc: List the status of user depending on volume of posts.
===================================================
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($messages as $message) {
$user = phorum_user_get($user_id, false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$message]["postlabel"] = $message;
}
}
return $data;
}
?>
===================================================
with -
{IF MESSAGES->user_id true}{LANG->Status}: {MESSAGES->postlabel}{/IF}</p></td>
in the 'read.tpl' template.
I put
'echo $data;'
}
after 'return $data; but I get a parse error when I do that.
hook: read|phorum_mod_status
title: Status Module
desc: List the status of user depending on volume of posts.
===================================================
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($messages as $message) {
$user = phorum_user_get($user_id, false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$message]["postlabel"] = $message;
}
}
return $data;
}
?>
===================================================
with -
{IF MESSAGES->user_id true}{LANG->Status}: {MESSAGES->postlabel}{/IF}</p></td>
in the 'read.tpl' template.
I put
'echo $data;'
}
after 'return $data; but I get a parse error when I do that.
Re: User status based on number of posts July 31, 2004 04:27AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: User status based on number of posts July 31, 2004 04:35AM |
Registered: 21 years ago Posts: 109 |
Re: User status based on number of posts July 31, 2004 04:37AM |
Registered: 21 years ago Posts: 109 |
Right, I fixed the 'array' word appearing. I now have -
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($messages as $message) {
$user = phorum_user_get($user_id, false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$posts]["postlabel"] = $message;
echo $data;
}
}
return $data;
}
?>
But still no joy.
:-(
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($messages as $message) {
$user = phorum_user_get($user_id, false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$posts]["postlabel"] = $message;
echo $data;
}
}
return $data;
}
?>
But still no joy.
:-(
Re: User status based on number of posts July 31, 2004 04:38AM |
Admin Registered: 21 years ago Posts: 9,240 |
thats a start ;).
also you are still messing variables.
change
foreach ($messages as $message) {
to
foreach ($messages as $message_id=>$message) {
where do you get $user_id from?
$user = phorum_user_get($user_id, false);
should probably be
$user = phorum_user_get($message['user_id'], false);
$data[$message]["postlabel"] = $message;
should be
$data[$message_id]["postlabel"] = $message;
Thomas Seifert
also you are still messing variables.
change
foreach ($messages as $message) {
to
foreach ($messages as $message_id=>$message) {
where do you get $user_id from?
$user = phorum_user_get($user_id, false);
should probably be
$user = phorum_user_get($message['user_id'], false);
$data[$message]["postlabel"] = $message;
should be
$data[$message_id]["postlabel"] = $message;
Thomas Seifert
Re: User status based on number of posts July 31, 2004 04:40AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: User status based on number of posts July 31, 2004 04:47AM |
Registered: 21 years ago Posts: 109 |
Right. Thanks. Sooooooo...now we have -
status.php -
===================================================
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($data as $message_id=>$message) {
$user = phorum_user_get($message['user_id'], false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$message_id]["postlabel"] = $message;
echo $data;
}
}
return $data;
}
?>
===================================================
info.txt -
===================================================
hook: read|phorum_mod_status
title: Status Module
desc: List the status of user depending on volume of posts.
===================================================
and in 'read.tpl' -
===================================================
{IF MESSAGES->user_id true}{LANG->Status}: {MESSAGES->postlabel}{/IF}
===================================================
and.................
it's still not working! :-)
Edited 1 time(s). Last edit at 07/31/2004 04:49AM by Mandingo.
status.php -
===================================================
<?php
function phorum_mod_status($data)
{
$PHORUM = $GLOBALS["PHORUM"];
if(isset($PHORUM["mod_status"])){
foreach ($data as $message_id=>$message) {
$user = phorum_user_get($message['user_id'], false);
$posts = $user["posts"];
if ($posts > 100) {
$message["postlabel"] = "You've posted a lot!";
}
else {
$message["postlabel"] = "You newbie!";
}
$data[$message_id]["postlabel"] = $message;
echo $data;
}
}
return $data;
}
?>
===================================================
info.txt -
===================================================
hook: read|phorum_mod_status
title: Status Module
desc: List the status of user depending on volume of posts.
===================================================
and in 'read.tpl' -
===================================================
{IF MESSAGES->user_id true}{LANG->Status}: {MESSAGES->postlabel}{/IF}
===================================================
and.................
it's still not working! :-)
Edited 1 time(s). Last edit at 07/31/2004 04:49AM by Mandingo.
Re: User status based on number of posts July 31, 2004 05:14AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: User status based on number of posts July 31, 2004 05:36AM |
Registered: 21 years ago Posts: 109 |
Totally lost with this now.
You're saying something like this -
$string =$data[$message_id]["postlabel"] = $message;
echo $data["postlabel"];
should be in place of -
$data[$message_id]["postlabel"] = $message;
echo $data;
???
===================================================
I'm giving up on this one myself, hopefully someone else with a bit more knowledge will pick up on it because it would be a nice feature but I'm finding it very frustrating.
Edited 1 time(s). Last edit at 07/31/2004 05:42AM by Mandingo.
You're saying something like this -
$string =$data[$message_id]["postlabel"] = $message;
echo $data["postlabel"];
should be in place of -
$data[$message_id]["postlabel"] = $message;
echo $data;
???
===================================================
I'm giving up on this one myself, hopefully someone else with a bit more knowledge will pick up on it because it would be a nice feature but I'm finding it very frustrating.
Edited 1 time(s). Last edit at 07/31/2004 05:42AM by Mandingo.
Sorry, only registered users may post in this forum.