Unsubscribe User From Topics

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Suggested Hosts
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

I know where the problem is but I cannot see why there should be a problem

The function that is going wrong is get_global_subscriptions in notifications manager and it looks as if for some reason it is using $user->data['user_id] - but I cannot find that either.

Notifications is just a total nightmare trying to work out what is happening!
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21292
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Unsubscribe User From Topics

Post by RMcGirr83 »

That's set on line 602 of the manager.php file. Pretty sure it has something to do with the subscription types. If I var dump those in the manager.php file in the ACP I get these set in an array

Code: Select all

  'NOTIFICATION_GROUP_POSTING' => 
    array (size=4)
      'notification.type.bookmark' => 
        array (size=4)
      'notification.type.post' => 
        array (size=4)
      'notification.type.quote' => 
        array (size=4)
      'notification.type.topic' => 
  'NOTIFICATION_GROUP_MODERATION' => 
    array (size=2)
      'notification.type.needs_approval' => 
        array (size=4)
      'notification.type.report' => 
        array (size=4)
  'NOTIFICATION_GROUP_MISCELLANEOUS' => 
    array (size=2)
      'notification.type.group_request' => 
        array (size=4)
      'notification.type.pm' => 
        array (size=4)
but var_dumping from with the UCP the array is different

Code: Select all

  'NOTIFICATION_GROUP_POSTING' => 
    array (size=5)
      'moderation_queue' => 
        array (size=4)
      'notification.type.bookmark' => 
        array (size=4)
      'notification.type.post' => 
        array (size=4)
      'notification.type.quote' => 
        array (size=4)
      'notification.type.topic' => 
        array (size=4)
  'NOTIFICATION_GROUP_MISCELLANEOUS' => 
    array (size=1)
      'notification.type.pm' => 
        array (size=4)
I'm not sure what file is populating the subscription_types as they are set as protected in the class but not mentioned in the comments.
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

That's the same as I am seeing.

Do you know who the notifications guru is?
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21292
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Unsubscribe User From Topics

Post by RMcGirr83 »

ExReaction originally coded it up but I'm sure that's zero help. May have to jump on IRC to see if a Dev can be poked to take a peek. I can't locate where that variable is getting populated.
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

I've found what is causing the problem.

In the get_subscription_types() function there is this line if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available()) and it is the last part ($type->is_available())that is the problem - it checks each of the notification type files and is basically using the current user (which in this case is an Admin)

Now have to write some messy code to get round it :evil:
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21292
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Unsubscribe User From Topics

Post by RMcGirr83 »

Yep, just actually found that out just now...literally. EG, for group_request there is a query run within group_request.php using WHERE user_id = ' . (int) $this->user->data['user_id'] . ' and in other places uses $auth (the methods are done in a similar manner).

Only thing I can think of, without having to refactor the entire bloody mess, is to temporarily change the user_data to the user. I've done this in the past in the contact_admin extension.

Have you opened a ticket yet?

EDIT: give me a minute or two...almost done ;)
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

RMcGirr83 wrote:
Sun Aug 02, 2020 11:49 am
temporarily change the user_data to the user
Tried that early on - makes no difference, it seems to get lost once into the notifications functions.
RMcGirr83 wrote:
Sun Aug 02, 2020 11:49 am
Have you opened a ticket yet?
I thought about it but as nobody is going to drop everything to look at it I didn't see any rush. Doubt it will get changed anyway!
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21292
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Unsubscribe User From Topics

Post by RMcGirr83 »

Think I got it. :D

Will make a push shortly.
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

RMcGirr83 wrote:
Sun Aug 02, 2020 1:01 pm
Think I got it. :D

Will make a push shortly.
Thanks Rich

Updated version - https://github.com/david63/acpusernotif ... ve/3.3.zip
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21292
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Unsubscribe User From Topics

Post by RMcGirr83 »

You're very welcome David! :D
Appreciate the extensions/mods/support then buy me a beerImage
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
User avatar
david63
Registered User
Posts: 18077
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Unsubscribe User From Topics

Post by david63 »

Extension now in Development forum - viewtopic.php?f=456&t=2562006
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
Post Reply

Return to “Extension Requests”