dourvas
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: lock and unlock a postHello And thanks for answearing.
I found an older similar question in their forum. I asked them myself too but they are on vacation these days.
It is a feature that they are not provide. I understand tht I have to built it my own.
I really need an idea about this
Forum: Fixing WordPress
In reply to: remove add users from profileok,
if i remove the capability from the role the create user tab dissappears from profile page and my custom page still can create users.I am having a role that does not have the capability to create users but through my custom page (programmaticaly using wp_insert_user) it creates.
Is something i am missing? It should work this way?
Forum: Fixing WordPress
In reply to: remove add users from profilehello, thanks for answearing
I do not want to remove add_user capability from the role. I want to maintain this capability.
I just want the user with that role to create users through my custom page and not through his profile page
Forum: Fixing WordPress
In reply to: custom role creation a pluginOk.
I have implemented the task. I am writing the solution i came up for two reasons
-i reaaly need some feedback about the solution ( i am new in WP and i do not want to find any suprises i didn’t see when the system is up and running)
-To share with other members that perhaps are looking for something like thisSteps
- i installed MEMBERS plugin. I created two custom roles with names coyotemanager and coyotestudent. I gave to the coyotemanger the capability to create and edit users.
- I installed the plugin MEMBERSHIP 2. i created 2 memberships. Manager and student. I connected those memberships with the same roles using this code (put in functions.php of your theme)
add_action( 'ms_model_relationship_create_ms_relationship_before', 'ms_controller_member_assign_memberships_done_cb', 99, 4 ); function ms_controller_member_assign_memberships_done_cb( $membership_id, $user_id, $gateway_id, $move_from_id ) { $user = new WP_User( $user_id ); switch( $membership_id ){ case 5814: //found it in MEMBERSHIP 2 $user->set_role( 'coyotemanager' ); break; case 5844: $user->set_role( 'coyotestudent' ); break; } } - I created a WP page. I gave access to this page only to coyotemanager.
- I wrote a php snippeset. the current user (coyotemanger only) can create a specific amount (you specify it into the code) of students.
<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "ld"; $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //get the number of students////////////////////////////////////////////// $sql="SELECT * FROM wp_usermeta WHERE meta_key ='description' and meta_value='".get_current_user_id()."'"; $result = $conn->query($sql); $num_students = mysqli_num_rows($result); echo "Σύνολο μαθητών σου:".$num_students.""; /////////////////////////////////////////////////////////////////////////// //create sql to get the name and lastname od teacher's student//////////////////// $i=1; while($row = $result->fetch_assoc()) { $query[$i] = "SELECT * FROM wp_usermeta WHERE user_id ='".$row["user_id"]."'"; //echo "query=".$query[$i]; $i++; } /////////////////////////////////////////////////////////////////////////////////// //run the queries get name and last name and print/////////////////////////////////////// $j=1; while ($j !== $num_students+1) { $result1 = $conn->query($query[$j]); while($row = $result1->fetch_assoc()) { if ($row["meta_key"] === "first_name"){ $userdataname= $row["meta_value"]; } if ($row["meta_key"] === "last_name"){ $userdatalname = $row["meta_value"]; } } echo "id: " . $row["user_id"]. " - Name: " . $userdataname. " " . $userdatalname. ""; $j++; } if ($num_students <3)// 3 users { echo "may add still ". 3-$num_students."μαθητές "; echo' <form name="usercreation" method="POST" onsubmit="return form_validation()" action="../usercreation.php"> Name: <input type="text" id="student_name" name="student_name" /> Last Name: <input type="text" id="student_lname" name="student_lname" /> Email: <input type="text" id="student_email" name="student_email" /> username: <input type="text" id="username" name="username" /> <input type="submit" value="Submit"/> </form>'; } else { echo "No more users"; } $conn->close(); ?>The php file usercreation.php (form action)
<?php // Get data require_once('wp-load.php'); $student_name = $_POST["student_name"]; $student_lname = $_POST["student_lname"]; $student_email = $_POST["student_email"]; $username = $_POST["username"]; if( null == username_exists( $username ) ) { // Generate the password and create the user $password = wp_generate_password( 12, false ); $managerid= get_current_user_id(); $userdata = array( 'user_login' => $username, 'description' => $managerid, //store the manager's id into students data 'first_name' => $student_name, 'last_name' => $student_lname, 'user_pass' => $password, 'user_email' => $student_email, 'role' => "coyotestudent" ); $user_id = wp_insert_user( $userdata ) ; //On success if ( ! is_wp_error( $user_id ) ) { echo "User created : ". $user_id; } else{ $error_string = $user_id->get_error_message(); echo '<div id="message" class="error"><p>' . $error_string . '</p></div>'; } // Email the user wp_mail( $email_address, 'Welcome!', 'Your Password: ' . $password ); } // end if ?>Still needs form validation and css
Forum: Fixing WordPress
In reply to: custom role creation a pluginThanks for the answer.
I surely do not have a plugin like this. I just mentioned my thoughs about dealing with the issue I descriped in my previous post.I understand your feedpack about changing the datadase. I will try to think of another solution.
If you have an algorithm about solving that please shareForum: Fixing WordPress
In reply to: custom role creation a pluginthanks for your answer.
I will write the actions i have allready done about that task and the thoughts i am having about its completion
I have created a custom role. I used MEMBERS plugin. I named the role manager and i gave him the capability to create users and to edit users.
I remind you that i want him to be able to create a SPECIFIC number of a SPECIFIC role.
I have a thought and i want some advice here. I should mention that i can code but i am new in WP. That is a solution a would probably follow if i had chosen to built this custom and not through WP
I am thinking to first go to database and add the field MANAGERID to users table
Then i am considering of building a form. I mean Pages –> New –> html tab –> and build a page with a form.In this new page i will restrict the access only to members with the role of manager. (i have already tried that succesfully using a memberhip plugin)
This form should contain the necceserry fields of a new user. Submiting the form the data goes to table alongdide with the managerid of the manager.
In that way i can count the users each manager created and i can both
-manage the edit to the right users and
-manage to limit the number of users created.I do not have a clue how to set the roles for the created users
Is that a valid doable solution?
I am really open to any other suggestions, tips or anything relevantForum: Plugins
In reply to: [Interactive Content – H5P] report into third-party softwareit sounds awesome.
I wlil need some time to test itthank you very much for your help
Forum: Fixing WordPress
In reply to: Gamification pluginhello again
i have communicate with captain up’s team and they told me that the plugin is not there anymore because it is not free. it costs 120 dollars per month!. but the code is still there (github) that’s way i am asking. it seems a little bit odd. You may know that the particular plugin works in conjuction with an account in captain up’s site. Your WP communicates with an API to your captain’s up account. The registration to captain’s up though is free! May i use it for free (from github) or not?
I have already tried some plugins as you proposing. I got tired and i thought i could use the experience of the users of the forum. It seems that i may need a custom solution.
There are enough plugins about gamification and points. But it seems that the points are awarded only to posts, or to login or to facebook likes etc. I want to award the users for answering questions or to other custom actions they might do. I want to choose (as an administration) those actions
Forum: Fixing WordPress
In reply to: Gamification pluginThanks again.
Searching the posts in support badgeos for similar questions i found out that with badgeos you can not earn points without earning a badge.I need a gamification system that awards with points custom actions that i can set(the right answer of H5P questions) and badges every specific amount of points.
Any ideas?
And something else relevant to the discussion. As i mentioned before captain up is a valid solution. But it is expensive. The code of captain up is in github. Does this mean that there is a way to use it for free?
Forum: Fixing WordPress
In reply to: Gamification pluginthanks again for your answer.
I saw that too as soon as i read your previous answer (i mean the sentenses concerning points into badgeos list). Since then i am trying to understand how it is possible and i did not do it. I wiil study it a lit bit more.
It was the first plugin i checked a month ago. i have not been able to do it then either.
i want to use H5P for creating questions (multiple choice or whatever) and reward with points and badges (every 300 points a badge) the users for the right answer.
I will check better BadgeOS. If you or someone else are thinking for another one solution please share
Forum: Fixing WordPress
In reply to: Gamification pluginthank you for your answer
Yes i know that one. It is a solution that does not fit into my needs because there are no points included. Only badges.
To tell you the truth i did not checked it thoroughly. Do you know that you can give away points by badgeos? I think not
Forum: Fixing WordPress
In reply to: mails doesnt arrivesomething like this??
require_once(‘wp_mail_smtp.php’);
??/
i can not understand how to activate it inside plugins.php ???? please help……………..Forum: Fixing WordPress
In reply to: mails doesnt arrivei did not get what i should do in plugins.php
Forum: Fixing WordPress
In reply to: mails doesnt arrivei am new at programming in general and this is a topic i dont know at all.
how do i set smtp?when i extracted the plugin i set my gmail account in it.
$wpms_options = array (
‘mail_from’ => ”,
‘mail_from_name’ => ”,
‘mailer’ => ‘SMTP’,
‘smtp_host’ => ‘smtp.gmail.com’,
‘smtp_port’ => ‘465’,
‘smtp_ssl’ => ‘SSL’,
‘smtp_auth’ => TRUE,
‘smtp_user’ => ‘[email protected]’,
‘smtp_pass’ => ‘my psw’
);
as i said before i only extracted it in plugin dir
u mean this ??Forum: Fixing WordPress
In reply to: mails doesnt arrivehow can i activate it.??
it is in greek ..
dourvas.dyndns.org/wordpress
it will confuse u..