1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

problem CB with fabrik

Discussion in 'Community' started by samani, Dec 17, 2018.

  1. samani

    samani Member

    Level: Community
    hi,
    i install CB plugin of fabrik but get this error when i go to user profile :
    Call to a member function get() on null
     

    Attached Files:

  2. samani

    samani Member

    Level: Community
    i implement some trick for example use CB Custom Html with enabled content option and it work but how i can use fabrik-prefilter to load result related to this user?
    i use this in Custom field: {fabrik view=list id=1}
     
  3. lousyfool

    lousyfool Active Member

    Level: Community
    Set a prefilter in the list:
    where <your_field_containing_user_id> equals {$their->user->id}, and set type to text.
     
  4. samani

    samani Member

    Level: Community
    tahnk you lousyfool but it is not work.

    @hugh, can you reply me what need to do? is integrated work correctly?
     
  5. lousyfool

    lousyfool Active Member

    Level: Community
    Well, you're asking Hugh, but trust me, I have this running here: a Fabrik list loading in a CB user profile tab displaying only the data for this user = the list rows where what I called "<your_field_containing_user_id>" contains the user ID.
    (I'm using a Fabrik module, but surely it's all the same when using the content plugin.)

    What's the table you want to display, what's the name of the field containing the user ID?
    Have you made sure you're selecting the "raw" field in the prefilter?
    Any more detailed information of what you have and what you are doing available?
     
  6. samani

    samani Member

    Level: Community
  7. lousyfool

    lousyfool Active Member

    Level: Community
    Thanks for the screencast, I tried following it.

    Hmmm, perhaps it's best if I describe step by step what I did to achieve what seems to be a very similar task:
    In a tab in CB user profiles, display a Fabrik list containing only the rows related to this CB user profile. Actually, it's the table with CB "Profile Updates": #__comprofiler_plug_pulogger, where the ID is in the column "profileid".
    So, while this may be slightly different from what you need (list module vs menu item, PU logger vs a different table in your case, etc...), the concept should be the same, so it may help you and perhaps others to replicate for your use case:

    1. Create a list for the table in question (#__comprofiler_plug_pulogger). In my case, no list joins or pre-filters are set, I only set "Order by" in the Data tab and ACL to my particular needs.
    In case you're using the list elsewhere fo other purposes as well and set pre-filters on list level, make sure you get the "Overridden by menu/modules" right, of course.

    2. Create a module of the type Fabrik List, select the list and save. Configure the module to your needs.

    3. In the module, Advanced tab, click Prefilters and set it to:
    AND
    (for Elements) profileid (or whatever the user ID field's name is in your case... I did not choose "raw" but the "non-raw" option)
    EQUALS
    (for Value) {$their->user->id}
    (for Type) Text (if you chose a "raw" field or there's no choice, you may want to select "No quotes" instead)
    (for Access) make sure it's set right, otherwise no joy!

    4. Close and save, then insert module in a CB tab the usual way.

    So, as already stated, this works perfectly fine for me.

    You may play with the variable/placeholder. As per Wiki (you linked to it) where it's said that ($their->yyy->xxx) works similar to the {$my->xxx} placeholder, you might also get it working with just {$their->id}, not sure. Also, since CB comes with its own placeholders, you may try using one of theirs (look up with CB which one it is).

    Hope it helps.
     
    samani likes this.
  8. samani

    samani Member

    Level: Community
  9. lousyfool

    lousyfool Active Member

    Level: Community
    Hi,

    Watched your screencast -- very entertaining :)

    What I didn't see you trying is, as suggested in my previous post, using CB's own placeholder.

    I haven't tried this instead of what I've got in use (and I will not do so on the live site, sorry), but as described here, it should be something like
    Code (Text):
    [cb:userdata field="user_id" user="#displayed" /]
    If this type of CB placeholder works at another place or with another field variable in a profile on your site, it may well do the job here, too.
    Try that?

    By the way, no need for another screencast... "tried it, did (not) work" or so will do! Also, because if this does not work, I'm running out of ideas...
     
    samani likes this.
  10. lousyfool

    lousyfool Active Member

    Level: Community
    Sorry, I've edited the post above because I had wrongly "#me" in it... while you need "#displayed"...
     
  11. samani

    samani Member

    Level: Community
    i can do that with this code and it work:
    Code (Text):

    global $_CB_framework;
    $userid=$_CB_framework->displayedUser(); //work in single user profile view not in list view
    return $userid;
     
    you can use that in the calc element but must use when cb profile is show. i use {fabrik view=details id=1} in the CB Custom field.
    but it is not work in the list view of CB.
     
    Last edited: Jan 26, 2019

Share This Page