As guest, you are not able to comment any post. bypassperms doesn't help. The error is located in the user-info a guest has, incl. the group-info. without user-info no group-id and without group-id no permission-datas.
there is a way to fix it. the problem is, that false datas will be returned if function get_advinfo will be used for getting guests member and group infos.
so posting as guest will be blocked by function add_post at this point:
obviously, the has_perms-function uses the get_advinfo-function to get the content of the g_reply_other_topics-var. but get_advinfo returns false data when guests-infos are requested.
so you have to fix the get_advinfo-function in the IPBSDK:
just replace
function get_advinfo($memberid = '') {
if (!$memberid) {
// No UID? Return current user info
$memberid = $this->ips->member['id'];
}
with
function get_advinfo($memberid = '') {
if (!$memberid) {
if($this->is_loggedin()) {
// No UID? Return current user info
$memberid = $this->ips->member['id'];
} else {
// Return guest group info
// guests group-info fix by Matthias Reuter (http://pc-intern.com | http://straightvisions.com\)
$this->DB->query ("SELECT * FROM ibf_groups WHERE g_id='2'");
if ($this->DB->get_num_rows()) {
$info = $this->DB->fetch_row();
$this->save_cache('get_advinfo', $memberid, $info);
return $info;
} else {
return FALSE;
}
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1457161
Originator: YES
using revision 26 of SVN-code
Logged In: YES
user_id=1457161
Originator: YES
there is a way to fix it. the problem is, that false datas will be returned if function get_advinfo will be used for getting guests member and group infos.
so posting as guest will be blocked by function add_post at this point:
} else {
if (!$this->has_perms('g_reply_other_topics')) {
$this->sdkerror($this->lang['sdk_noperms']);
return FALSE;
}
}
obviously, the has_perms-function uses the get_advinfo-function to get the content of the g_reply_other_topics-var. but get_advinfo returns false data when guests-infos are requested.
so you have to fix the get_advinfo-function in the IPBSDK:
just replace
function get_advinfo($memberid = '') {
if (!$memberid) {
// No UID? Return current user info
$memberid = $this->ips->member['id'];
}
with
function get_advinfo($memberid = '') {
if (!$memberid) {
if($this->is_loggedin()) {
// No UID? Return current user info
$memberid = $this->ips->member['id'];
} else {
// Return guest group info
// guests group-info fix by Matthias Reuter (http://pc-intern.com | http://straightvisions.com\)
$this->DB->query ("SELECT * FROM ibf_groups WHERE g_id='2'");
if ($this->DB->get_num_rows()) {
$info = $this->DB->fetch_row();
$this->save_cache('get_advinfo', $memberid, $info);
return $info;
} else {
return FALSE;
}
}
}