• I need to create an illusory “post” to visitors that presents content customized to the user. I’m sure there’s a way to do it, but it is impossible to find an answer in this forum, as the lowest number of hits I’ve had to any of my searches has been about 3,000 (or 0). This is a typical issue with most forum support systems.
    This would be a “sticky” post that appears at the top of the roll for any visitor. It would use their cookie to determine the content, which may be a number of things, such as thumbnails from image galleries, “hot” links, filtered posts, etc.
    The main thing is that it would be dynamically created for the unique visitor, based upon their cookie. It would not be in the database. I would do things like have a TTL for the content, so the visitor doesn’t lose it if they do a page refresh, etc.
    Now, using filters, I can create the content, no problem. What I want to figure out, is there an approved way of generating the “post” itself, and is there a way to ensure that it is always at the top? I’m sure that there’s got to be a way. I know how to do it by going in and hacking, but I won’t do that. I want to use the plugins and templates the proper way.
    Any help would be greatly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • There’s a sticky post plugin called Adhesive. Here’s an addy for the author’s site: http://www.asymptomatic.net/. You might be able to tweak the code to do what you want with the cookies and content….

    Thread Starter cmarshall

    (@cmarshall)

    Thanks! I got it, and I’ll look it over. It probably won’t give me exactly what I need, because I’ll bet that it uses posts in the database. Remember that I am trying to avoid creating a database post, although I may be able to create a blank post (like I do for intouch) that has the content dynamically generated. In that case, this is exactly what I need.

    Good luck, and please keep us abreast of your development process – what you’re trying to do probably has implications for others. If you get it worked out, you might do a plugin?

    Ummm. You aren’t trying to create ‘real post’, you’re trying to ‘fake’ one, right?

    Then, if is_home, and page==1, before The Loop processing occurs you can just ‘fake’ a post. All you need is the right div wrappers and other tags to make something look/format like other posts.

    Let me know if you need more help. Again, assuming you only want this on the homepage, customized for a given logged in user or something (personalization?), you either hand-code it into the template file, or create a fake post, use Adhesive or CG-PostOrder to ‘sticky’ it, and use something like CG-QuickPHP, or phpexec, etc. to run some dynamic output.

    -d

    Thread Starter cmarshall

    (@cmarshall)

    Yeah, I’m trying to obey all the rules, so I can upgrade seamlessly. I rewrote Nuke once, and got my site taken down by a script kiddie hack because I didn’t apply the fix. Never again.
    The more I think about it, the more I like the idea of creating an empty “stick” entry that has its content built on the fly. I can create an on-the-fly plugin for my particular need (I have a peer Gallery 2 installation, and I want to create a “Newest Images” post). I’ll be happy to share what I learn. I’m not sure if a single plugin will be useful, more like a set of heuristics.

    Thread Starter cmarshall

    (@cmarshall)

    Well, I have it pretty much working. It still needs some refinement, but the whole site is under construction, so it will coalesce quite well, I’m sure.
    You can see it here: http://www.tcryan.com/blog/?p=5
    Right now, it shows the whole library, but I’ll uncomment the line soon that does this, so it will only show what has been added for the particular visitor.
    It is fairly basic: The plugin code sets a cookie with the current visitor timestamp, but it will only update it once in 24 hours, so the visitor can go back and see the same images more than once in a given time period. This means that the post will appear differently for each user. If someone visits every day, then they will only see a few images. If they visit infrequently, they will see a lot more images.
    In this particular case, I am checking a partner installation of Gallery 2 (Bingo release) for new images, and displaying thumbnails of those images, along with links to the full-resolution images within the Gallery. It’s a nice shortcut for a personal site that probably won’t be featuring too many new images. If this were a pro gallery, then I would probably use the Gallery implementation, which is more robust, but a lot more complex for the user.
    I did this by creating a blank plugin with a “your content here” type HTML comment. The plugin will process this, and replace it with content as necessary. I used the “Adhesive” plugin to make the post “sticky.” I will probably create an excerpt for the post that indicates the number of images therein. As I said, I still have a fair bit of work in refining the functionality.
    I ran into a very nasty problem in WordPress, and was a real puzzler for me. I’d suggest that you consider addressing it. I had originally used the “add_action” and “add_filter” functions to register the plugin hooks, but they didn’t work. I went nuts trying to figure out why, but then I got it: WordPress does not call the hooks for the “get_” versions of the processing functions. I need to use these because I massage the content heavily (notice that all pages validate XHTML 1.1 and WAI AAA). I don’t want to just display it. There also seems to be no hook for a “pre-header” operation. I set a cookie, so I need to do that.
    This means that I directly call the plugin functions from my template code. Yucchy, but still within the parameters for a “non-hack” modality. The templates and the plugin need to be installed as a set. I’m not particularly happy with the solution, but it works, and it will still allow WordPress to be updated, which is what I want.
    I think this kind of functionality is a pretty important “basic” capability of a blog. Many blogs seem to have it built in, and, quite frankly, I was surprised that WordPress didn’t. I’ll be happy to provide any code to anyone who wants it, but it may not be very useful, as it is directly relevant to this particular site’s customization.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Creating a Customized Dynamic “Post”’ is closed to new replies.