NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 16, 2012 18:19:57 GMT -8
Wormo, is it possible to get a version of the Relationship Status Code that is ONLY editable by admins. (And then I'll probably have to dig out the part where we re-wrote it to work with unchained.)
|
|
|
Post by Wormopolis on Jan 16, 2012 22:13:14 GMT -8
admin alone or a list of allowed members?
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 17, 2012 4:53:01 GMT -8
List of allowed members
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 19, 2012 16:31:58 GMT -8
Bump
|
|
|
Post by Wormopolis on Jan 19, 2012 17:27:30 GMT -8
up at the top
var allowModsToChangeOthersStatus=false;
if (document.modifyForm) {
change to
var allowModsToChangeOthersStatus=true; var allowedToChange="admin|user2|user3|user4";
urgx=new RegExp('^('+allowedToChange+')$',''); if (document.modifyForm && pb_username.match(ugrx)) {
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 19, 2012 19:52:55 GMT -8
It no longer shows up as an option in anyone's profile (including the main admins..who I am logged in as.)
|
|
|
Post by Wormopolis on Jan 20, 2012 0:42:30 GMT -8
typo. I did urgx on the first line and ugrx on the second. pick one and go with it
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 20, 2012 9:37:55 GMT -8
I think I shall have to move that if statement lower in the code somewhere. Because the way it's set up now is that it will only create the forms if the persons profile is listed in the allowedToChange array.
Need to make it so that it creates the form in everyone's profile but only those people listed have the display="block" setting.
If I'm right then we need to focus on this line here:
if (!(document.modifyForm.password || pb_username=='admin' || allowModsToChangeOthersStatus)) nwrw.style.display='none';
I implemented this version of the code:
<script type="text/javascript"> <!-- // relationship status v1.1 // by Wormopolis - [url]www.wormocdes.com[/url] // request by Shannon // keep header intact
var RSchoiceArray=[ ['Weapon to',true], ['Meister of',true] //no comma last entry ];
var allowedToChange="admin|giriko"; urgx=new RegExp('^('+allowedToChange+')$','');
if (document.modifyForm) { var genderRw=document.modifyForm.gender.parentNode.parentNode.parentNode; var nwrw=genderRw.cloneNode(true); nwrw.firstChild.firstChild.innerHTML='Partner:'; var choicetemp=''; for (aa=0; aa<RSchoiceArray.length; aa++) {choicetemp+='<option value=' +RSchoiceArray[aa][1]+ '>' +RSchoiceArray[aa][0]+ '</option>';} nwrw.firstChild.nextSibling.firstChild.innerHTML='<select name="relation" onchange="document.modifyForm.relationname.disabled=true; tmp=(this.value==\'false\'); document.modifyForm.relationname.disabled=tmp;"><option value=false></option>' + choicetemp + '</select> <input name="relationname" disabled="true">'; nwrw.firstChild.nextSibling.nextSibling.firstChild.innerHTML='Enter your Partners Name.'; nwrw.style.display='none'; if (pb_username.match(urgx)){ nwrw.style.display='block';}
genderRw.parentNode.insertBefore(nwrw, genderRw); if (modifyForm.personaltext.value.match(/\[RS:(\d+?)(=(.*?))?\]/i)) { var keepRS=RegExp.$1; var keepRSname=RegExp.$3; modifyForm.personaltext.value=modifyForm.personaltext.value.replace(/\[RS:(\d+?)(=(.*?))?\]/i,''); modifyForm.relation.selectedIndex=keepRS; if (keepRSname) { modifyForm.relationname.value=keepRSname; modifyForm.relationname.disabled=false;} } function saveRS() { if (modifyForm.relation.selectedIndex!=0) { modifyForm.personaltext.value+='[RS:'+ modifyForm.relation.selectedIndex + (!modifyForm.relationname.disabled ? '=' + modifyForm.relationname.value : '') + ']'; } } if (document.modifyForm.addEventListener) { document.modifyForm.addEventListener('submit',saveRS,true); } else { document.modifyForm.attachEvent('onsubmit',saveRS); } }
if (pb_action.match(/display|viewprofile|search2|calanderview/)) { for (tds=document.getElementsByTagName('td'), tt=0; tt<tds.length; tt++) { if (tds[tt].width=='20%' && tds[tt].className.match(/windowbg/) && tds[tt].vAlign=='top' && tds[tt].innerHTML.match(/\[RS:(\d+?)(=(.*?))?\]/i)) { var keepRS=RegExp.$1-1; var keepRSname=RegExp.$3; tds[tt].innerHTML=tds[tt].innerHTML.replace(/\[RS:(\d+?)(=(.*?))?\]/i,''); var newStuff='Relationship: '+ RSchoiceArray[keepRS][0] + (keepRSname!='' ? ' '+keepRSname : '') + '<br>'; tds[tt].innerHTML=tds[tt].innerHTML.replace(/Posts:/i, newStuff +'<br>Posts:'); } } } // --> </script>
And it allows the admin account to modify the relationship for the admin account but I can't modify the user accounts. Users are unable to modify their own accounts currently.
(And on another note: I implemented the original version and set the allowMod to true but it wouldn't let me edit another persons status even as admin.)
|
|
|
Post by Wormopolis on Jan 20, 2012 15:19:29 GMT -8
lemme look again... its should have not made the form for anyone but the users listed.
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 20, 2012 16:15:32 GMT -8
Okay let me try explaining again.
I want the form to be there and the information to be stored for every user, but I only want the admins to be able to edit the info. So I can go in as the admin and set it so that this person is partnered with that person.
The way it was set up (the edited version) was it was only creating the form for the people listed, and not everyone.
|
|
|
Post by Wormopolis on Jan 20, 2012 16:40:52 GMT -8
try version 1.3 in the database. see if that works. I did a logic map so hopefully I caught it.
|
|
|
Post by Wormopolis on Jan 20, 2012 16:41:31 GMT -8
I knew what you meant. I just had the logic setup wrong before.
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 20, 2012 18:19:01 GMT -8
Still not letting even the main admin change other peoples status. Could it possibly be because it's splitting the gender option? Which isn't editable by anyone but the user themselves?
|
|
|
Post by Wormopolis on Jan 20, 2012 19:21:09 GMT -8
holy crap... I totally forgot they removed that ability...
I changed it to personal text.. see if it worksnow
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Jan 20, 2012 20:36:25 GMT -8
Works perfectly now.
|
|