Drupal subscriptions to taxonomy only - drupal

Playing around with the subscriptions module; i have some troubles getting it to send the right notification for right subscription.
Here's the situation :
I have a content-type of type 'work'; it has a cck-taxonomy field; when creating the content users choses one category in which his 'work' fulfills.
In user profil, under Categories (user/3/subscriptions/taxa) I choose two categories, lets say 'house work' and 'car work'.
When creating a new 'work' content I do not get the notification.
But, when manually select 'content-type' in user's profile of type 'work' I get the notification e-mail but independant to which 'category' i had chosen.
This is quite annoying since I only want the user to receive his notifications upon the taxonomy he has chosen, not for every new content of type 'work'.
Am I missing something obvious here ?

i have made it working fine for a taxonomy using the settings provided by the module. Concerning the rights i only allowed 'Subscribe to taxonomy terms '

Related

Reviewable Module Form Field Integrated Into Testimonial Module

I'm using the Reviewable module just for the form field that gives a star rating a user can select.
That produces a form field with a hidden field called 'score' for a 1-5 rating a user can pick.
I'm trying to modify this Testimonials module and page so I can use that rating field and it is submitted and written to the database. I'm having issues passing it into the validateSubmission function I guess because the rating is never stored in the database. It is always 0.
I'm probably just going to fork the Testimonials module so I don't mind hard coding the changes into the module instead of using data extensions.
I added the reviewable form field to the TestimonialForm FieldList but having problems passing to validate the submission function.
From TestimonialForm()
$fields = new FieldList(array(
TextField::create('Author', 'Your Name'),
TextareaField::create('Content', 'Your Testimonial'),
\Reviewable\RatingField::create('Rating', 'Please rate us out of 5 stars'),
));

Wordpress - Add a user as custom field of CPT

Intro info:
I have a Custom Post Type (CPT) called Service.
I am already connecting users to this CPT using the plug-in 'Posts 2 Posts', this is a many to many relation, and these users connected to the CPT represent the 'team' of said Service.
Alright so here's the headscratcher:
Now I want to create a custom field in the CPT Service, which will be the Director of the Service. Say a field called 'Director' in which the value is a User.
Ideally, the value of the field Director is a User, not a string representing the user name or anything like that.
I have no idea how to start tackling this issue and some brightness on the subject would be strongly appreciated.
Thank you!
save it as post_meta. e.g if you have the user email:
$user = get_user_by( 'email');
update_post_meta($serviceid, '_director', $user->ID);
If you are setting this up in the admin section you can add a meta box and attach a action to save_posts to save a html field where you select a user. Google add_meta_box, there are a load of tutorials on this.

WP_Insert_Post change status depending on previous submissions

I have created a frontend form that allows logged in users to submit content to my wordpress site. The form allows them to submit to a custom content type. I would like be able to change the status of the submitted post depending on that users previous submissions. So if they already have 1 or more published posts then the submission goes to publish - if they don't then it goes to pending.
I know the argument that I need to change: 'post_status' => 'publish' - I just don't really have a clue how to start on the logic - let alone what the most efficient way of achieving it will be...?
first, set post_status as a PHP variable that is set by a function, and hard coded returned from within the function.
Then, refactor the function to do a separate WP_Query to find the count of published custom post types with the current userid as author. If >=1, return 'publish' else return 'draft'

Number of posts next to user in users.php excluding Custom Post Types

I have noticed that the list of users generated by users.php in my dashboard doesn't take into account custom post types when it displays the number of posts by each user.
So even if a user has 20 posts of a custom post type, it will still show '0' next to their name.
Does anyone know how to resolve this and add custom post types to this number?
For anyone else looking to achieve the same, I managed to resolve it using this solution...
function my_manage_users_columns($columns) {
$columns['post_type_count'] = __( 'Books', 'textdomain' );
return $columns;
}
add_filter('manage_users_columns', 'my_manage_users_columns');
With 'Books' being the name of the custom field

Drupal: help with content type creating & linking nodes

I have a situation where someone can create a job content type. I've added a CCK field that is related to the 'organisation' content type. So when someone creates a new job posting they can choose which organisation the job is for in that field (auto completed). The problem is I can create a new job and select any organisation, even if I didn't create that organisation myself.
Is there a way I can restrict what someone types in that field to 1. an organisation name that exists, and 2. an organisation that belong to that user?
I'm using drupal 6.
Any help most appreciated!
Jonesy
You can use a php rule for the allowed values array of your node reference field, which I think in your case would need to run a quick query for all the nodes made by the current user.
I have not tested this code, but it should be reasonably close to what you're after if I have understood the question!
global $user; //make sure we have access to the user
//find all the job organisation nodes made by this user
//(replace organisation with the actual name of your content type)
$query = db_query("select nid from {node} where type = 'organisation' and uid = %d", $user->uid);
//put the results in the values array
$values = array()
while($result = db_fetch_result($query)){
$values[] = $result;
}
I'm not in a place where I can check this easily, but you could also try using a select on the edit page, and display the choices with a view. Then, create a view over the content type and check that the node user is the logged in user.
You could use a Nodereference field.
It's Autocomplete, and on the bottom of the settings of the field, you can select a View to filter the Nodes that can be referenced ( it's called "Advanced - Nodes that can be referenced (View) ")
Just make a View limiting the nodes to nodes that the current logged in user created, and use that on the Nodereference settings page.
Using that option, drops the option 'Content types that can be referenced' which is located above the Advanced settings.
So make sure to add a filter on node type.
I assume you already use Nodereference, and you might have looked past that option

Resources