HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Unpinnable message?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#77205 (In Topic #15890)
Avatar

Fan in action

Sorry, I'm very new to OCPortal, and this is the first time I've dealt with forums. I have a site. It has forums. We believe we've figured out the permissions and set them correctly for each forum. Pinning a message has not been a problem, until last night. The guy running the forums created a new sub-forum. He is the same guy with the same access that created all of the forums and admins the forums pretty well. He also pins messages with no problems. So last night he created a new sub-forum, like always, and it got new messages posted to it by various people, like always. But when he wanted to Pin one of the messages, he discovered there was no Pin option, as there is in other forums. he also says he has no Delete option, like he normally does. My question, though the permissions seem to be the same as the other forums we have, is this a permissions problem? Or, is he somehow Not the forum's moderator for this forum, even though he created the sub-forum? Any advice on finding this setting?

Next question. we have a Gallery. It was so popular that I clicked 'allow users to have their own personal galleries.' And now we have a lot of personal galleries, for each user on the site. Excellent. But those users are posting about 20 new pictures a day, and Validating them is taking a lot of time. I know that each gallery has its own permissions, like each forum does, but, to get the pictures to auto-validate, I'd have to edit every personal gallery's permissions. That would take all day, or more. And then what about new users that create new galleries? So, my question…how can I Mass-validate the incoming pictures in personal galleries? Also, how do I Mass-Change the permissions to all the personal galleries at once, and for the future, so that all new picture submissions are auto-validated?

Thanks for any suggestions, all. Amazing software.
Back to the top
 
Posted
Rating:
#77206
Avatar

Hiya, these don't sound easy questions so no need for your nervous disclaimer there ;)!

Regarding pin permissions, please attach screenshots from the edit forum screen of the forum and it's subforum, so we can verify the permissions really are the same. Looks like an odd one to me.

Regarding the gallery perms, I think probably each gallery has default permissions. i.e. does not override them. If that's the case you can just set what you need on the galleries module itself (using the Permission Tree Editor). Then it will automatically cascade.

Regarding validating things you already have, you'll need to do a query in OcCLE:

Code

:$GLOBALS['SITE_DB']->query_update('images',array('validated'=>1));


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77248
Avatar

Fan in action

Okay thanks for that. I found the tree editor and fixed a lot of things on my list. I have another thing here on my list I can't figure out without just editing php where I know I shouldn't. I have a box on the top of my site. I willed it with cool icons to replace the default site-menu box on the left. The icons do things like take the user to the Forums, or Gallery. One of the icons is a bit tricky, though. I want that icon to take the user to the Gallery upload area, so they can upload pictures. It's just a shortcut, to avoid first going to the Gallery, and then clicking on Add Picture. Turns out that some times the user isn't logged in, of course, and so we don't have a valid user number all of the time. So the url I link to on that icon is missing a key ingredient. It's missing the user's number. If a user is logged in, and you go through the Gallery to post a picture, the url is something like this

Code

http://www.example.com/cms/index.php?page=cms_galleries&type=ad&cat=member_2_root

That tells OCPortal which Gallery we are going to upload to. But what if the user is not logged in? I tried this

Code

http://www.example.com/cms/index.php?page=cms_galleries&type=ad

But OCPortal doesn't stop you and ask you to log in. Neither will it let you upload a picture, of course, because there is no valid Gallery in the url. So I'm looking for a way to link that icon to a url that might say "login first" if it's a guest, or carry the correct member number if it's a logged in user. Alternately, maybe some comcode that will Not print the box on the page If it's not a logged in user. There are 2 comcode's similar, but they don't look at the user status, that i can see. Any ideas?
Back to the top
 
Posted
Rating:
#77256
Avatar

Community saint

I haven't done this for a while but look in the docs for the "if-in-group" condition. Non-logged visitors (Guests) are in group '0'.

Bob
Back to the top
 
Posted
Rating:
#77259
Avatar

Fan in action

Bob, that worked great. I misunderstood that tag, I guess. I thought it means "wrap" as in text only. So I never tried to "wrap" other code in it. Works great. I had to make some assumptions about the equates though. I am assuming group 2 through infinity is a logged in group. It looks like either group 1 or 2 is a non-logged in user/guest. This beggs the question…if group 1 is a Guest, what is group 0? If group 0 is a Guest, what is group 1?

I worry that I'm leaving out a group in my if-in-group tag (0 or 1) unnecessarily. So what is group 0 and 1? Anyone know for sure?
Back to the top
 
Posted
Rating:
#77260
Avatar

Community saint

As I recale, Guests are group 0 and Admins are group 1 but it's been a while since I played at this. This arrangement makes it easy to exclude guest and admins and only address logged-in users. There is quite a bit of flexibility as I recall.

Bob
Back to the top
 
Posted
Rating:
#77261
Avatar

Fan in action

Okay. One last question I think…and I've got it all figured out. How would I use php from inside a page's code. Here's some pho I used in a miniblock that works great…

Code

<?php
require_code ('forum_stub');
$userid = get_member();
$username=$GLOBALS['FORUM_DRIVER']->get_username($userid);
echo $userid;
echo $username;
?>

That code works well, but only in a miniblock, so far. I tried to get it to work inside the main website's page, but it won't go for it. It seems to want to, because it transforms the php into something else. But maybe it's just choking on it…I'm not sure. What I want to do is something like this:

Code

<?php
require_code ('forum_stub');
$userid = get_member();
$username=$GLOBALS['FORUM_DRIVER']->get_username($userid);
echo $userid;
echo $username;
<a href="http://www.example.com/cms/index.php?page=cms_galleries&type=ad&cat=member_$userid_root">link test</a>

But I can't figure out how to embed php among the other comcodes and blocks that make up the main from page of the site. Any idea how to do that?
Back to the top
 
Posted
Rating:
#77263
Avatar

I really would keep it as a miniblock.

If you need to pass things in, it's easy.

Let's say your miniblock is foo.php and you do…

[block whatever="this"]foo[/block]

From the PHP code you have access to the parameter via $map['whatever'];
(it's magically defined for you)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77279
Avatar

Fan in action

Okay I did end up making a miniblock for it, and that worked, of course. But it would be cool to just insert some code to reveal the userid. I found some codes that looked promising, but it didn't work. It was

[codeblock]{$USERNAME} and {$USER}[/codeblock]

But that actually doesn't work in quotes. And escaping it with a * or any of the others didn't work, either. However, those codes outside quotes seemed to work. Is there a way to get those to work inside something like

[codeblock]
<a href="http://www.example.com/cms/index.php?page=cms_galleries&type=ad&cat=member_{$USER}_root">link test</a>[/codeblock]

That would be such a simple solution for so many links

PS Bob, Found out Guest group = 1, Admin group = 0
Back to the top
 
Posted
Rating:
#77281
Avatar

Community saint

Oops….like I said,it has been a long time since I needed to have a group condition. Anyways, you got it working.

Bob
Back to the top
 
Posted
Rating:
#77298
Avatar

They do work in HTML quotes. But you have to use the 'semihtml' tag, not the 'html' tag. If you use the 'html' tag no additional processing inside that tag can happen.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77357
Avatar

Fan in action

This software is massively cool. I appreciate the help! I'm getting things worked out. Got something on my list now that's got to be dealt with. In the chat system…the flood rate is set to 0 (zero) already.

o) However, there is quite a lag in sending messages out to a chat room. How can I speed that up by…a lot.

Thanks you for your patience!
Back to the top
 
Posted
Rating:
#77363
Avatar

Faster/closer server? Lol, I know, not helpful.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77501
Avatar

Fan in action

That was helpful, actually :)

New issue: Few hours ago a guy created a new account and went on a spam-fest. I can fix everything except the ability for a new user to email other members. I looked in the site-tree-editor, but didn't see an option to prevent newbies from sending emails to other users. How can I do that, other than remove the option from the whole page?
Back to the top
 
Posted
Rating:
#77502
Avatar

permissions on contactmember module, set via permission tree editor


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77869
Avatar

Fan in action

Okay I've looked for a few hours for a more clear identification of what a quiz id looks like. I believe it is not the same as the name of the quiz, even though when you take a quiz or edit a quiz, the "id" in the url suggests the quiz id is a string very similar if not equal to the name of the quiz itself. I believe this because when I call get_quizz_data_for_csv with the id for the quiz found in the url when taking the quiz, it returns an error suggesting that there is no such column in the database. here's my error:

Unfortunately a query has failed [SELECT t1.*,t2.q_member,t3.q_answer_text FROM ocpo_quiz_entry_answer t1,ocpo_quiz_entries t2,ocpo_quiz_question_answers as t3 WHERE t2.id=t1.q_entry AND t1.q_answer=t3.id AND t2.q_quiz=blah-competency-test ORDER BY q_order] [Unknown column 'blah' in 'where clause'] …

The url for the quiz is very similar to this:

Code

http://www.witcheschat.com/index.php?page=quiz&type=do&id=blah-competency-test

So I tried to use occle to discover the table and column names, but actually this doesn't work:

Code

:$GLOBALS['SITE_DB']->show tables;

Neither does this:

Code

:$GLOBALS['SITE_DB']->select * from ocpo_quiz_question_answers;


So I'm trying to access the quizzes data so that I can auto-add a member to a usergroup If they pass a particular quiz. Where I'll actually do this is yet to be determined, but first I have to access the data, or more specifically, the members that have "passed" the particular quiz. My miniblock code that does not yet work is called from a test page, passing "id" correctly, but errors out:

Code

<?php
require_code('ocf_members');
require_code('ocf_members2');
require_code('quiz');

$ary = get_quizz_data_for_csv($map['id']);
print_r($ary);
echo '<br />';
echo $ary;
echo '<br />';

Any ideas about finding out the id of the quiz?
Back to the top
 
Posted
Rating:
#77874
Avatar

Community saint

Malatesa said

[Unknown column 'blah' in 'where clause'] …
This error is caused by mission single quotes, i.e.:
…AND t2.q_quiz='blah-competency-test' ORDER…

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#77889
Avatar

You're smart Malatesa and doing very well, but you're getting a bit ahead of yourself with the coding. You just need to learn the syntax of the various languages a bit more first.

To execute a query in ocPortal, using ocPortal's API, and PHP's syntax…

Code

$result=$GLOBALS['SITE_DB']->query('SQL GOES HERE');
Here's your show tables query, written for OcCLE:

Code

:var_dump($GLOBALS['SITE_DB']->query('show tables'));
The ':' marks it as a PHP command to run, and I used var_dump to show the results directly.

Regarding the codes in the URL, they're not the IDs, they're "monikers" (url_monikers table defines them). They're generated from name/title/whatever-the-content-type-has, and they map to the ID numbers in the rows. It's for SEO/nice-URLs.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#77936
Avatar

Fan in action

Okay thank you. My original goal was to automatically add a member to a usergroup when they successfully pass some given test. I've figured it out–at least one possible method. Here's what happens…there are several text fields in a quiz. One that tells the member they have successfully passed the quiz (if in fact they have), one for a failure to pass (if they failed the quiz) and one that just tells the member about the quiz before they take it. In the text fields that informs them that they have passed the test (if they did), you can actually add blocks. So I created a miniblock that looks like this:

Code

[block group_name="Computer Nerds"]add_quizz_passer_to_usergroup[/block]

And I added it to the text field of the quiz that is displayed if the member passes the quiz.

add_quizz_passer_to_usergroup.php is the miniblock and looks like this:

Code

<?php
require_code ('forum_stub');

# the id of the member
$user_id = get_member();

# the members nickname
$user_name=$GLOBALS['FORUM_DRIVER']->get_username($user_id);

# the parameter passed from the block, the group to admit the user to
$group_name_parameter = $map['group_name'];

# do the database query to find data on the group_name
$g_info=$GLOBALS['FORUM_DB']->query_select('f_groups',array('id','g_name','g_group_leader','g_title'),array('t0.text_original'=>$group_name_parameter),'',1);

# Make sure we have valid data coming back from the query.
if (!array_key_exists('id',$g_info[0])) warn_exit(do_lang_tempcode('MISSING_RESOURCE'));

# the id of the g_name. Actually the id of the group_name_parameter we passed in the block
$g_id=$g_info[0]['id'];

# The final version of the group's name, run through language translations? Not sure, but this is the way to get the group's name.
$g_name=get_translated_text($g_info[0]['g_name'],$GLOBALS['FORUM_DB']);

#echo $user_name;
#echo ' passed, so we are adding them to usergroup ';
#echo $g_name;
#echo '<br />';

require_code ('ocf_groups_action2');
# add the user (user_id) to the usergroup (g_id)
ocf_add_member_to_group($user_id,$g_id,1);


When the member passes the quiz, the miniblock is executed and the member is entered into the usergroup immediately.

So if someone wants to admit members to usergroups automatically, this code might help a bit.

If your block contains an incorrect usergroup name, it will error out and give you the trace. Same error will happen if it's an invalid user, or if for any other reason the query from the database didn't return something we can use. This code only has one bothersome issue. The database call references t0.text_original when it should reference g_name or even g_title. But I can't get g_name to work there. perhaps it's yet part of a bigger object that needs dereferencing or something. I dunno. Nor do I know for sure what t0.text_original is. But it does work LOL! Anyone with insight as to how to use g_name in that call instead of t0.text_original?
Thanks Chris.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: