Join our new community forum for support & discussion
Join NowHome › Support › Extensions › Requests › How to adjust the display of blocks at the function level?
How to adjust the display of blocks at the function level?
-
AuthorPosts
-
Sergio 1 year, 8 months ago
Hi!
How to adjust the display of blocks at the function level?
For example, if I am logged in and on the page of my listing https://experthive.hivepress.io/listing/professional-videography-for-any-events/ I don’t need to show the Reply to Listing button.
Or I logged in and went to my request page https://experthive.hivepress.io/request/experienced-flooring-specialist-needed/ – the Make an Offer button is clearly superfluous for me.
Etc.
———
Привет! Как на уровне функции регулировать отображение блоков?
Например, если я авторизован и на странице моего листинга https://experthive.hivepress.io/listing/professional-videography-for-any-events/ кнопку Reply to Listing мне показывать нет необходимости.
Или я авторизовался и зашел на страницу своего реквеста https://experthive.hivepress.io/request/experienced-flooring-specialist-needed/ – кнопка Make an Offer для меня явно лишняя.
И тому подобное.Sergio 1 year, 8 months agoAnd how to add a prohibition on actions, for example, if a user is registered and logged in as an expert, then do not display the “Create request” buttons for him and additionally, if he suddenly looks at the link of the “Create request” button, prohibit him from creating a request in the database.
Those. if registered and logged in as an expert, then make available only the expert’s functionality.
And vice versa – I registered as a customer, prohibiting all the functionality associated with the listing.
—-
И как добавить запрет на действия, например, если пользователь зарегистрировался и авторизовался как эксперт, то не отображать ему кнопки Создать реквест и дополнительно, если он вдруг подсмотрит ссылку кнопки Создать реквест, запрещать ему создание реквеста в базе данных.
Т.е. если зарегистрировался и авторизовался как эксперт, то сделать доступным только функционал эксперта.
И наоброт – зарегистровался как заказчик, запретить весь функционал, связанный с подачей листинга.Hi,
The easiest way would be hiding these via CSS. If you want to also remove these from the HTML markup then you can try filtering these templates and override the corresponding block types to “content”.
Displaying the “Post a Request” link conditionally would require overriding the /request/submit/request-submit-link.php template part via a child theme, and adding a condition there, for example:if(!current_user_can('edit_posts')) {
This would mean that the current user is not Contributor (this role is assigned to vendors).
Sergio 1 year, 8 months agoThanks.
And in the next topic, the role was defined like this, how is it more correct?if ( is_user_logged_in()) { if ( count_user_posts( get_current_user_id(), 'hp_vendor' ) ) { } }
Спасибо.
А в соседней теме роль определялась вот так, как правильнее?You can safely check the “edit_posts” capability, since HivePress assigns it to any user with a vendor profile. Checking if there’s a related vendor ID is not required (it would perform an extra database query).
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.