forum topic subscri...
 
Notifications
Clear all

[Solved] forum topic subscribed by user is set to ADMIN not to him ?!

6 Posts
2 Users
0 Reactions
546 Views
Posts: 5
Topic starter
(@mahi33)
Active Member
Joined: 2 years ago

Hi,

I have a strange behaviour or bug on a private forum.

On the same computer...
1° in Firefox I have page /participant/maxgarin/subscriptions open. This user has one forum-topic subscription "Envoi à tous" and wants to add the topic "Agriculture et élevage"
2° When submitting the "Agriculture et élevage" topic is not added to the user's maxgarin list, BUT TO ADMIN ?!
3° in Brave where admin is logged I have on /participant/{admin}/subscriptions page the forum topic added by user maxgarin (see attached JPG)

This is really odd. User subscriptions on page /participant/{user}/subscriptions are set to the
/participant/{admin}/subscriptions.

I checked the wpforo_subscribes SQL table and confirms the subscription transfer from user to admin.

Can you please help me trace and fix the problem ?

thank you

Topic Tags
5 Replies
Posts: 5
Topic starter
(@mahi33)
Active Member
Joined: 2 years ago

Additionnal information...

The subscription submission form "wpf_sbs_form" contains a hidden field "wpforo[userid]" with  value = 1 (this is ADMIN). It should be 7 for user "maxgarin" (see JPG test with another user). This explains why ADMIN is getting the user subscription.

Now why is the user ID getting lost when displaying page : /participant/{user}/subscriptions and falls back to 1 ?

The Wordpress login cookies are correct :
- domain : federation-francaise-de-geobiologie.org
- name : wordpress_logged_in_7e3863606bc70e6f2e98232e1eba9c04
- value : maxgarin%7C1671300294%7CQaO5vbcmAIgWltPeSgDYThJUY6iwg04itakB1GPHZTK%7C8d5d9b71952dbc99616393cf0474c6ee605ef6dd273475363f59a9f33985dea6

any idea ?

 

Posts: 5
Topic starter
(@mahi33)
Active Member
Joined: 2 years ago

OK, I found the problem and patched

wpforo/modules/subscriptions/classes/Template.php

Same behaviour on PHP 7.4 and PHP 8.1 with wpForo 2.1.1 and Wordpress 6.1.1

On line 32 in Template.php => $userid is assigned to 0

public function manager_form( $userid = 0 ) {

In my case however $userid is an ARRAY() with the following values being connected as "maxgarin" and the default value 0 is not taken.

userid[0] = Array
val[subid] = 93
val[itemid] = 8
val[type] = forum-topic
val[confirmkey] = 1d989ced9d29275b5185ea66f171ac7e
val[userid] = 7
val[active] = 1
val[user_name] =
val[user_email] =

On line 43 we have

$userid = intval( $userid );

But intval( array() ) returns 1 if not empty => which is the ADMIN userid in my case

I patched this line and changed it to

$userid = (is_array($userid)) ? 0 : intval( $userid );

And the userid is retrieved correctly and is 7 (in this example) and this solves the problem.

Does this makes sense to you ? Will you include the patch in the next wpForo release ?

thank you

 

3 Replies
Chris
(@chris)
Joined: 3 years ago

Famed Member
Posts: 3627

Hi @marc-hild,

We will take a look on this and late you know.

Thank you very much.

Chris
(@chris)
Joined: 3 years ago

Famed Member
Posts: 3627

Hi @mahi33,

We have found the problem and we are working on it, The issue would be fixed in the new version.

Thanks

(@mahi33)
Joined: 2 years ago

Active Member
Posts: 5

Hi @chris 

Thank you for your support !