How to show private pages based on a user's role?

For example. User "Mary" should be able to view to the private page "marys page" after logging in, "Tom" should be able to view the private page "toms page", etc I created new users and am using the "user role editor" plugin to assign them to their own role. Each user will be able to see their own private page. I am using "peters login redirect" to redirect each user to their own private page. My problem is that I …
Category: Web

Learndash groups content protection with tags

Currently, I use learndash to protect courses and memberpress to protect posts/pages tagged "premium". Learndash provides the option to lock posts/pages with learndash groups. However, it only has the option to lock contents inside post editor by selecting individual courses/groups. How can I make learndash groups to protect posts/pages tagged premium so that I can deactivate memberpress and use only learndash?
Category: Web

Allow users to only CREATE one single (custom) post

I created a custom post type with taxonomy and now want to allow users (of a specific user group) to post only one single post in a specific category. If the user has already posted a post, he can only edit his own post (I already have the PHP for that). I found a lot of solutions that users can only post in a specific category or only edit their own posts, but no-where an conditional that the user can …
Category: Web

Restricted images only for logged user. (hidden url)

Im looking for way to create page where only logged in user can see images, but images cant be index by browser, cant be accessed by not logged in user. Simply, if logged in user copy image link, and not logged in user try see it, he should see 404 or some other redirect, logged in user should be able to see this image. (Link should not expire). And Image can be downloaded ofc. :) And it is way to …
Category: Web

Uploading attachment (pdf) and prevent download for anonymous user

I have a website which is public available and there we have "internal" area, these are simply pages with the visibility set to protected. So wordpress ask the visitor for the password (the password is for all users the same). In this internal area I want to provide a pdf for view and download but I don't want that it is possible to "simply" guess the URL and download the file without authorization. All I found are several plugins which …
Category: Web

Show content if user left comment / non-logged visitors?

im trying to hide content/show content based on comments. i tried this to achieve what i want. but i want to hide/show content from non-logged visitors also.. this is my final code: // the user may have commented on *any* post define( 'CHECK_GLOBAL_FOR_COMMENTS', FALSE ); // // some more code // add_shortcode( 'membervip', 'memberviparea' ); function memberviparea( $atts, $content = null ) { $post_id = 0; // if the user have to left a comment explicit on this post, get …
Category: Web

can you help review CCCP (Conditional Cookie Content Post) and help to create a block?

I just need for one site with a front en video with sound to remove the video after two view I achieved to make it with cookie to show/hide a class can be seen a demo at https://accedinfo.com/2021/12/28/wordpress-masquer-ou-afficher-un-bloc-apres-x-vues/ and this is the used code it works with post or blog but need to adjust everything inside Maybe somebody can use this to create CCCP = Conditional Cookie Content Post bloc ? (and no, i'm not an old cccp citizen) /* …
Category: Web

Limit users to specific uploads

I'd like to restrict users to only see/manage only their own uploads. However, there's a requirement to allow one than one account to manage these uploads. It cannot just be the person who originally uploaded them. Is this possible?
Category: Web

URL Restrictions? Need only people who are logged in AND have a specific role (or roles) to access all pages for a site

I have a site that needs to only allow people who are logged in and have at least one of 3 possible roles to have access to the pages of the site. I'm not new to programming, but am new to both php and web development. I would prefer an "in-house" solution instead of a plugin, but at this point I will take what I can get. So how it would ideally work was that a user from our main …
Category: Web

Protect sequence of pages with same password for each of two groups of users

I'm currently creating a home page (learning environment) with wordpress. It should serve for an experimental study with two conditions. Based on the condition a participant will be assigned to, he or she should be redirected to one of two different page sequences. This redirection should start after page 10. After clicking through the group specific sequence of pages then, all participants should finally get redirected to shared (group independent) pages again. So, they start with the same pages, then …
Category: Web

Limit file downloads to logged in users (WP + Nginx)

I am looking for a way to restrict access to mp3 files on my site to logged in users only. The approach listed here sounds pretty much like what I need: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} ^.*(mp3|m4a)$ RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] RewriteRule . - [R=403,L] except how would I convert these .htaccess rules to nginx?
Category: Web

How prevent direct access to PDF file

I am trying to protect a pdf file from direct downloading. I am using the PDF Embedder plugin to embed the PDF file - a first step into preventing its download. Then with JS I have disabled mouse right click, CTRL+ shortcuts. I inserted a redirection when the browser detects JS deactivated. I have found some "holes" in my method where someone could grab the link. So in my .htaccess I added RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/ [NC] RewriteRule \.(pdf)$ - [F,NC] …
Category: Web

Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx - not only Apache - solution

Talking about this well known solution: Github Original discussion I'm looking for a straightforward way working also on a Nginx installed WP and not only on Apache ones. Is there any other code-based approach you would recommend, that works fine on any server environment? So far, after testing various plugins from the official repository on a Nginx installed WP website, I also discovered that a bunch of them just fail when the web server is not accepting htaccess rules. In …
Category: Web

How restrict video to be open on direct url hit

i have client website of premium E-learning videos on wordpress. i have uploaded all the videos(MP4) in wp-content/uploads directory. i have problem since it is a premium video i want it such a way that no one can download or see the video with hitting direct file url eg. http://mywebsite.com/wp-content/uploads/2016/01/video.mp4 I want to restrict above url from function i also expect file to be work properly in my website though.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.