Okay
  Public Ticket #3060396
Content Restriction option
Closed

Comments

  • brian started the conversation

    Hi

    I am trying to keep certain content on this page and force people to signup if they want to view it. If you go down the page to the world forex broker and the commissions table (generated by your very nice plugin). BUT it would be very nice to have a permissions option so it only displays for author or editor or plain old registered users.

    https://metamatrix.club/top-brokers-of-2022

    How can I achieve that? 

    Thanks

  • brian replied

    If you had this in the software + alt messages/ content/ widget. It would be really good for important data to only be displayed to signups or even paying customers.

  •  1,702
    Miloš replied

    Hi, brian 

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    - I am sorry to disappoint you, but at this time, we don't have built-in functionalities in wpDataTables in order to hide or load data on the page depending on user roles as you described.

    Same goes for tables, and alt messages/ content/ widget.

    I will pass this to the developers as suggestions to improve the plugin in the future, but please feel free to search on this page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and it will be forwarded to our management for review.

    After it's been reviewed it will be presented on the front page, for voting. Please note that it may take some time before your suggestion is brought up for voting since we receive quite a lot of suggestions on daily basis, and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like, where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    At this time, the only ideas i have, for loading certain data or tables depending on the user role ( if they are author or editor or just registered users);

    We have a built-in feature to only display rows for logged in user ID, you can check this out here;

    But what you need here is to be dependent on user roles to present certain data. I will offer a couple of workaround examples.

    -

    1.

     If the dependency is a user role, for example, we have an example workaround to filter rows.

    If I have this table:

    5458776907.png

    This is a manual table which has manually entered IDs from wp_users and roles from wp_usermeta:

    7855603551.png
    6462766399.png
    7686895681.png

    So, then I go to create an SQL query based table which will display entries based on user roles using this query:

    SELECT  new_table.id AS ID,     
       new_table.role AS Role,     
       new_table.product AS Product,     
       new_table.amount AS Amount
    FROM wp_wpdatatable_6 AS new_table
    JOIN wp_usermeta AS new_table_1
    ON new_table_1.user_id = %CURRENT_USER_ID%
    AND new_table_1.meta_value LIKE CONCAT('%', new_table.role, '%')
    

    When I'm logged in with user ID = 1, I see this:

    9999185249.png

    When I'm logged in with user ID = 4, I see the same thing. And when I'm logged in as one of the subscribers, I can only see the rows where role = subscriber:

    2907856651.png

    The only difference is that as subscriber I don't have access to back-end, so this confirms it is working on both front and back.

    So, we're only left with hiding unnecessary columns, adding names, and so on.



    2.

    Another workaround, you could create multiple tables on multiple pages.

    You can have one main "source table" that holds all the data and columns. 

    It could be a Manual type, or SQL based (has to be created in the database),

       and then create separate tables from it by an SQL Query, each query can pull only the columns you need for a certain role. 

    (an Admin can have access to the main/source table).

    -

    I hope that perhaps this can help for the time being, to give you an idea for a workaround, until the developers create built-in solutions in the future.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables