• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Multiple access type modifiers are not allowed

CrispinP

Well-known member
#1
Hi folks,

I'm having a clash with one of my add-ons (paid) and someone else's add-on.
Thread is here: https://xenforo.com/community/threads/user-map-paid.116884

In my data writer, I extend DataWriter_User

Code:
class Crispin_UserMap_DataWriter_User extends XFCP_Crispin_UserMap_DataWriter_User
{

    public function _postSave()
    {
        // call parent
        parent::_postSave();

        if (!XenForo_Application::get('options')->crispin_usermap_enable_geolocation_on_save)
            return;
....snip

The error is coming in because another add-on is doing the same thing but his _postSave method is protected. Mine is public.

At first I thought fair-enough, it's an _ method so perhaps protected is correct. However, if I specify protected then I get the error:
Multiple access type modifiers are not allowed


So...
a) Who's correct? Me or the other add-on?
b) if other add-on then what I do too correct it and make it working in future?


thanks
C
 

Thomas.B

Well-known member
#3
Multiple access type modifiers are not allowed
Afaik this error occurs only if you (accidentially) state more than one access modifier such as in public private myMethod()

The _postSave() method in the XF core is declared as protected. So you should also use this modifier for your method..
 

CrispinP

Well-known member
#4
yup, I was being silly. Apologies - I should have updated the thread.


I did have it as public by mistake. The give-away should have been the method starting with an underscore.

When I fixed that I got the "multiple access type" error because one of the methods being called was public.

All in all - it was a PEBCAK error :)