Conditional find and replace based on logged-in status or user role?
-
On the plugin screenshot of how a ruleset is creates one sees some conditional settings on the right such as:
Post Type: [ Any ? ], Querystring, Referrer, User Agent.Is it possible to perform find/replace operation based on any of these conditions:
– User is [ Anonymous | Logged in ]
or more fine grained:
– User role: [ ] Admin [ ] Editor [ ] Subscriber [ ] None (=Anonymous)
Note: If no role is selected the operation is performed for any request!If not yet possible, would you consider it for implementation?
My use case: Portfolio with work for companies which are ok with showing selected assets/projects but due to business discretion don’t want to be mentioned by name or have incoming links from my site.
So my project index and various project pages like:
/projects/ /projects/a/ /projects/b/ ... /projects/x/
Link to companies pages with abstracted names (in slug and title) like:
/companies/european-car-manufacturer/ /companies/international-chemical-corporation/ /companies/regional-bank/
Interested parties get a login and with this can see the full company pages (with the full name and more details).
So for logged in users I would perform these replacements:
<a href="/companies/european-car-manufacturer/">European Car Manufacturer</a> ? <a href="/companies/citroen/">Citroen</a>
And the real company pages like
/companies/citroen
get their visibility set to hidden (core WordPress feature) so even a direct URL input would enforce a login then.
- The topic ‘Conditional find and replace based on logged-in status or user role?’ is closed to new replies.