I don't know if this is beyond the flag/rules modules before i install them both again. I was wanting to change a posts title colour if it has been flagged as NSFW (not safe for work). I dont have a dirty site or anything but sometimes my members pop in the odd picture of a woman's breasts even if we're talking about something very unbreast related and safe for work.

I was hoping to spare their blushes and maybe save their jobs by being able to flag certain posts as NSFW and folks will know not to click it.

An alternative would be for flag to add NSFW to a title or something similar. All thoughts on how to achieve this would be appreciated.

Thanks

Comments

quicksketch’s picture

This really depends on how you are making your listings of content. It'd be pretty simple to assemble a view that changed the titles of nodes based on if they were flagged.

- Make a new view, add a field for "Node: title".
- Add the Flagged Content relationship, select your flag.
- Add a field for Flag: Is Flagged, rewrite the results of that field to something like "nsfw", check the option to not output if empty. Exclude from display.
- Rearrange your fields so that the Is Flagged field is above the Node: Title field.
- Rewrite the node title field to something like this:
<span class="node-title [flag_is_flagged]">[node_title]</span>
- This will result in node titles that have a class of "nsfw", which you can use CSS in your theme to make whatever color you want. You could even output the token for is flagged multiple times like this:
<span class="node-title [flag_is_flagged]">[node_title]</span> ([flag_is_flagged])
Then you'd end up with both a class on the node for nsfw and it'd say it in text next to the node title.

fadgadget’s picture

brilliant quicksketch thank you very much. Ive been up all night and im just away to the football (soccer) but i will get stuck into your instructions later tonight when i get back. I think all that is well within my capabilities and i will post back how i get on. Again thanks for the detailed reply. Muxh appreciated :)

fadgadget’s picture

Thanks quicksketch i finally got around to looking at this after a very long sleep. Ive a feeling im gonna learn something important and great about css and drupal fields after this and also ive a feeling ive done something wrong. Actually i KNOW ive done something wrong. I made a quick vid, very quick in fact as im on a mobile broadband pay as you go dongle. this shows my view etc

Quick screencast
http://www.youtube.com/watch?v=aeFAcIhuAVc&feature=youtu.be (just over a minute long)

The major prob i have is that im already re-writing my title field elsewhere so as i can create a forum look on my latest page
http://onlinebanter.com/latest

Here's the code ive been using in the re-written field-

<span class="node-title [flag_is_flagged]">[node_title]</span> ([flag_is_flagged])[title]<div class="smalltexttime">[type] by [name] in [group_nid]</div>

I know that i have two title fields in there but i was just testing it. The output is like-

[node_title] ([flag_is_flagged])£36 all in (£36 all in being the post title. Same color as all post titles)

and my crappy basic css is

.nsfw a {
color: #ffffff;
text-decoration: none;
}

ive tried as an 'a href' and just without the 'a'

Sorry if im being a bit of a fud here quicksketch but i appreciate the help and as i say i think im gonna learn something important here. Ive only been at drupal for about 100hrs plus a week for the last 6 years :(

thanks

joachim’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.