Show user (role) specific content - wordpress

I'm working on a site which is going to be used by different schools my company that is working with. A school will have a specific user account and I want to be able to provide school specific content that will only be visible for the logged in school (pdf:s etc).
I've been looking around but haven't found a straightforward solution for this yet (is there even one?). So, what is the best way of doing this?

First of all you have to create a custom role with certain capabilities with the add_role() function and then show content based on the capabilities the current user has with the function current_user_can() you didn't mention if the content will be in the backend or frontend but the principle is the same.
Edit:
Also this plugin seems to cover what you need link

Related

What framework to use for a responsive private website that has individual areas?

A group of business owners have asked me to create a responsive website just for them (public-facing page is login page). They want to be able to login and each have their own individual area which will show their business location and information about their business. They have recently tested doing a survey about their business environment, and they liked it and want each survey result presented in their private area too. Note, each owner will not see the private information of other owners. However, they also want a shared area with resources relevant for their industry (e.g. latest regulations, relevant industry PPTs) which they all can see (again, not public facing).
My question is, what is the best framework for making this website, which will also look ok on mobile? Previously I've made public facing websites with Elementor and WordPress - which meet the 'responsive website' requirements and for which I can envisage setting up the shared resource area - but what to use for login and creating individual areas?
Ideally after a business owner logs in they will have a personalized dashboard with their business information, and links to their page with survey results, location map etc. However, everyone will have the same index, e.g. Homepage (individualized dashboard), Survey Results (which will only show their results), Resources (everyone will see the same thing), Newsletter (they all see the same one).
I have used a free online form maker and made a digital version of the survey for them already, which automatically loads the data to a Google Sheet and then I split results in chart form to individual sheets with per person viewing permission. I have each owner's business location data ready in Google Maps. All these items I can easily embed into a page - once I have a framework setup for these private areas.
There are only about 18 business owners so it isn't a lot. I looked at using the WordPress inbuilt page password function to do this but it isn't working on most browsers for me, and I found many others encountered this same issue. I've looked at "WordPress client portal" plugin (uses password protected categories), WordPress Client Portal Plugin from SuiteDash (has the functionality but it is very very slow), ClientPortal (I can't find any option to try this plugin), and WP Customer Area (this seems great, but I found it too difficult to use even though it is free. I realize maybe my understanding isn't good enough - but I can't find good guides in English for it).
I also found some other "membership" type plugins, but they were relevant for providing customers with paid content at a tier level. I.e., you login and if you pay for "S" tier then you get access to that content. There is no paid content for the website that these owners want.
Appreciate any advice anyone may have on a suitable framework. I don't mind paying for something that fits these needs! Thanks for your help.

Other users seeing a 3rd party website with same user stylesheet

I have a group of users that will be using a web database.
Ideally, I would like these users to view that website with some user styles of our creation (so that some of the website elements are displayed differently, like highlighting fields they need to fill out). These users are independent and remote, meaning that we can't really access their computers to do anything to set this up (like setting up Stylish for them).
I was wondering if we could somehow create a package that will display the website using such stylesheet, as if it was an application rather than a website that they visit with their browser.
The idea would be that by opening this "app" they're actually opening a dedicated browser window to this webpage where they can interact with it, can't navigate away (just no address bar), and uses this stylesheet I mentioned. Thus the "as if it was an app".
I hope I was sufficiently clear. I don't even know what this would be called (not even what tags to use), so my research has really taken me nowhere. Guidance on how to get this done will be highly appreciated. If somebody has a better idea of how to obtain a similar result, I'll be happy to experiment!!
Thanks!
Will the users be logging in through user accounts in your database?
If so, create a column in the user database which, should it return a certain value (say true for these special users and false for all else) then a different stylesheet is used.

How to add a bespoke social sharing message to a specific page

I've used services like 'Add This' for a while but now I need to add a couple of specific bits of functionality to an ecommerce order completion page. It's to work like Amazon's order thank you page where it allows you to post a message to Facebook saying something like 'I just bought a widget on Amazon'.
Equally I'm looking for the equivalent in Twitter.
I've added a bunch of OG tags and share buttons but can't get it to do what I need. From further reading it sounds like I might need to create a Facebook app of some sort and use FB ui to create the link to post to the user's wall. I was hoping to do this without getting tangled up in that level of permissions etc but maybe that's not possible any more?
This is being developed on asp.net C#, in case there's a library that I haven't found in my searching.
Can anyone familiar with this type of development point me in the right direction?
For Twitter, the simplest way is to use Web Intents.
For example, if you want to share the text
I love http://example.com
URL encode the text to I%20love%20http%3A%2F%2Fexample.com and use the Twitter Web Intent URI. E.g.
https://twitter.com/intent/tweet?text=I%20love%20http%3A%2F%2Fexample.com
When the user clicks on that link (try it!) or is directed there by your service, they'll be prompted to share that text.

Personalized protected frontend content on a "per User" base in Wordpress

For a current project i need to provide some of the client's clients (you go it? =) some kind of protected frontend content area. This area should hold protected content on a "per User"-base.
For example: Tom from (lets call the company EXCORP) wants to provide User A with a document (PDF) and some Text (HTML-Content). But(!) User B would get a totally different document and maybe some more Text. User C would possibly not get a document at all.
This Game goes on for circa another 150 users or so. So going by "default" roles doesn't work here, since i would have to create one user-role per user and that would definitely overkill it. And all the Membership Plugins i've found do not work that way.
Just to make that clear: This thing only goes one way. Meaning, Client-Supporter Tom (in example above) needs to provide all the clients some personalised information. Tom would be a Backend-User. Clients do not need to provide eachother some files or information. Just from one Backend-User to all the different Frontend-Users.
So my question clearly spoken: Is there a way to protect frontend content on a "per User"-base using Wordpress? It doesn't matter to me if I get it to work the "hacky" way, or by a premium/free plugin, as long as it is safe (I will use SSL of course). I just don't want to develop a plugin from scratch, though my client would never speak the budget to pay for it!
There are a lot of themes outhere that offer front end user dashboard, you can use one of thoes themes to have everything set up (user redirected to his/hers dashboard at login).
At this point you have many ways to acchive what you need, if it's not too much trobule to remember what user received what info you can simply add a user-box in post-creation/edit backend where Tom can create a post, attach files to it and asign it to another user(throw the user box).
Publishing the post as private and changing the author from Tom to the end-user should make your work much more easier.
P.S. Check classifieds themes to see how backend works the main difference between thoes and what you'll have to achieve is that the post is craeted by Tom but asigned to the user (very easy to do) and that the post MUST BE PRIVATE!!! don't forget this if the data is sensible!
I realize this is an old question, but thought this might help others. You could try using wp-document-revisions along with the members plugin to achieve what you are looking for.
Good luck.

How Can Wordpress Easily Provide A Voting and Commenting View For 5 Page Layout Possibilities?

Right now, when I create a media item, I can view it as admin by going through the Media then clicking on view, eventually I end up at [mysite]/blog/?attachment_id=31 which is a nice reduced version of the image (which can be clicked to appear large), and which has the nice feature that there is a place to leave comments at the bottom.
This is great for administrators. But I want anonymous users to be able to look at 5 different, fairly similar images, and make comments on the pages separately. So I'd like for the anonymous users who navigate to [mysite]/blog/?attachment_id=31 to find the same page the way it looks to admins.
But when going to that URL as an anonymous user instead of the image with comment form I get:
Sorry, no posts matched your criteria
So, how can I enable this permission for anonymous users?
If this is not possible, please rephrase the question as, "What is the best way to use Wordpress to get a bunch of anonymous people to vote on 5 different layouts and also to be able to comment on each of them separately, as I am trying to do at http://christian-filipina.com/blog/ ? (None of these are public URLs, please don't link to them.)
Do I need to create a page for each of those separate layouts and then use HTML to link to the variously-sized versions of the images?
When adding an image to the post make sure that "attachment page" is checked instead of "image file" This should fix your problem. See: http://codex.wordpress.org/Using_Image_and_File_Attachments

Resources