0

Ok I've almost completed a Wordpress site that is a multi-user Image Library. This is a private site, where users must be logged-in to view it.

The average user cannot get to the backend (wp-admin) at all. They are kept at the front end.

So my question is this: What is a clever way to enable a user to be able to 'add' a post (each post is an image - featured image) to a kind of 'cart' or 'lightbox' that is attached to themselves as a user (eg. the cart/lightbox is still there when they log back in - think iStockphoto) and then be able to share this 'cart' or 'lightbox' via email with someone else? ^See note below.

Tricky points bonus: I'm hoping that users can have more than one lightbox ('cart'), although this may not be a game-killer.

^ Note - sharing this link via email will not make anything publicly available. The sharing link will only work for other users who are able to login.

8
  • 5
    Recommending plugins are off topic here. Just a note, adding a bounty to a poor quality question does not bring the question up to standard. None of the functionality you have mentioned is part of core and needs to be implemented in some way. This makes your question very broad. What you are asking now is for a full project or a skeleton to a full project. I cannot see how this question can be sanely answered. Questions like these with bounties placed on top of it just brings poor quality answers with no concrete proof Apr 14, 2016 at 9:16
  • 2
    yeh, poor questions get poor answers. I don't think anyone cares enough about rep here to spend time for which he will not be paid just for it. Apr 14, 2016 at 10:24
  • I'm honing in on a bookmarking - posts system on the frontend. I'd definitely like to keep users on the frontend, and not have a system that relies on backend editing. Getting there. Apr 14, 2016 at 11:57
  • I suggest dumping the plugin and create a fresh system that allows anyone (logged in or not) to create and save collections (to the database). Then you can easily share the collection by name or id. Apr 14, 2016 at 17:25
  • 1
    Create a db table 'collections' with id and name of the collection, create a table with the collection_items: id, collection_id, post_id(or something) allow users to create collections or automatically create a collection when a non logged in user favorites a photo, either with postdata from a form on the page you want to place the 'add to collection' button or with nopriv ajax calls: add_action( 'wp_ajax_nopriv_ajax_add_to_collection', 'ajax_action_stuff' ); // ajax for not logged in users Apr 14, 2016 at 22:27

2 Answers 2

0
+50

I think you might have to modify the plugin, fork it, if you like the rest of it's functionality.

Then add functionality that when you "favourite" a post/image, instead of adding it to your favourites you get a list which collection you want to add it to. All of these collections could have their own url like www.mysite.com/user/collections/collection-name .

8
  • 2
    This is just a bloated comment, I cannot really see how this answers the question Apr 14, 2016 at 9:11
  • 4
    I will be nicer then PieterGoosen.... answers need to refer to the question and try to answer all of it (or explain why it is not possible or not a good idea). Your answer might be a good start but it is far from being even remotely a full answer. Apr 14, 2016 at 10:19
  • Thanks, but I'm not happy with a system that relies on cookies, so I don't want to simply fork that plugin. As mentioned, I'd like to hook into user meta so that the collections are remembered better per-user. I've now found a system that does 90% of what I need. I'd like a clever share between users function, but I think I can work with what I've got now. Apr 14, 2016 at 11:53
  • You might be on the right track though. I like the idea of multiple lists linked to each user (kind of what I've now got with this new bookmarking system) and also the url idea with /user/collections/collection-name. Can you flesh out this idea some more? Apr 15, 2016 at 1:19
  • 4
    Pieter , thank you for the constructive comment - really invites to a open and friendly community... @MarkKaplun - Yeah, okay I see the point. Should have written it as a comment instead. Kind of new here (participating), and didn't really see the "add a comment" link. It's not exactly prominently display, grayed out and tiny font :P Will have this in mind next time! :) Apr 15, 2016 at 9:07
3

Register a collection post type to represent a single collection. You'll get permalinks and rewrite rules to resolve the requests for free.

Insert a new collection post for a user when they create a collection, and save the chosen post IDs as an array in post meta. You can pass that array directly as post__in argument in a WP_Query instance to load the posts in the array.

6
  • 1
    You make it sound easy @Milo. Sounds like a good path to go down, and in fitting with the 'stick to core, stupid' philosophy around here. Let me see how I go ;-) Apr 15, 2016 at 7:34
  • I'm not sure what plugin everyone is referring to here, but +1 to this answer - the problem is only complicated because of how you're thinking about it ;) Milo has simplified it and found a way to achieve what you want - custom post types really do allow you do quite a bit with such a simple concept!
    – Tim Malone
    Apr 15, 2016 at 10:28
  • Thanks @TimMalone, I was using a Bookmarks plugin which was doing the bookmarking well but not the sharing with other users. The problem is that I'm a little stumped after registering a collection post type (easy, do it all the time), when it comes to wp_insert_post (never done it!) so I'm gonna have to brush up on my core skills when I really just want to get this done and dusted. ;-) Plus every wrong step you take around here you get penalised and hounded down so it's not a friendly place to tread as a non-expert coder! Apr 15, 2016 at 12:23
  • @MonkeyPuzzle I'm sorry to hear you've been penalised and hounded down! Downvotes are meant to be a democratic way of rising good questions and correct answers to the top, so that they help more users. You shouldn't take them personally, but rather take on the constructive feedback that will often be left with them. No, not everyone does that. And yes, it can sometimes feel like tough love. But programmers are often black and white; we need to be ;)
    – Tim Malone
    Apr 16, 2016 at 6:03
  • @MonkeyPuzzle Re needing to brush up on your core skills, that's good. Getting something done and dusted does feel good, but it'll feel better the more sweat you put into it. Plus, you'll learn more in the process, and be better able to apply what you've learnt to different situations, rather than just having one narrow use case! Feel free to come back and ask for more help if you get stuck :)
    – Tim Malone
    Apr 16, 2016 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.