diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 9aa9783dc87..6dfd879baf5 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -103,14 +103,16 @@ define('BLOCK_RSS_SECONDARY_CACHE_ENABLED', true); if ( $userisloggedin && ($submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) { $page = page_create_object($this->instance->pagetype, $this->instance->pageid); - if (isset($this->config)) { - // this instance is configured - show Add/Edit feeds link - $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $this->courseid)); - $output .= '
'; - } else { - // this instance has not been configured yet - show configure link - $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $this->courseid)); - $output .= ''; + if ($page->user_allowed_editing()) { // for SUBMITTERS_ALL_ACCOUNT_HOLDERS we're going to run into trouble later if we show it and then they don't have write access to the page. + if (isset($this->config)) { + // this instance is configured - show Add/Edit feeds link + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $this->courseid)); + $output .= ''; + } else { + // this instance has not been configured yet - show configure link + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $this->courseid)); + $output .= ''; + } } } diff --git a/blocks/rss_client/config_global.html b/blocks/rss_client/config_global.html index 06cc4eed3be..4e7592d2925 100644 --- a/blocks/rss_client/config_global.html +++ b/blocks/rss_client/config_global.html @@ -42,13 +42,15 @@ $selected = '0'; $CFG->block_rss_client_submitters = 0; } - // SUBMITTERS_ALL_ACCOUNT_HOLDERS => get_string('everybody') + // removed everybody option for 1.5 beta // things are not quite working yet to allow this - revisit later // also 'everybody' should be 'site members' or something clearer since // it does not include guests - $options = array ( SUBMITTERS_ADMIN_ONLY => get_string('administrators'), - SUBMITTERS_ADMIN_AND_TEACHER => get_string('administratorsandteachers') ); + $options = array ( + SUBMITTERS_ALL_ACCOUNT_HOLDERS => get_string('everybody'), + SUBMITTERS_ADMIN_ONLY => get_string('administrators'), + SUBMITTERS_ADMIN_AND_TEACHER => get_string('administratorsandteachers') ); choose_from_menu ($options, 'block_rss_client_submitters', $selected); ?> diff --git a/blocks/rss_client/config_instance.html b/blocks/rss_client/config_instance.html index 8f2f9ccd5a6..9b4382de9bb 100644 --- a/blocks/rss_client/config_instance.html +++ b/blocks/rss_client/config_instance.html @@ -74,7 +74,15 @@ if ($currentaction == 'configblock') { $selectedarray = array($this->config->rssid); } } - if ($rssfeeds = get_records('block_rss_client')) { + global $USER; + $admins = get_admins(); + $adminsql = ''; + if (!empty($admins)) { + foreach ($admins as $admin) { + $adminsql = ' OR userid = '.$admin->id; + } + } + if ($rssfeeds = get_records_select('block_rss_client','userid = '.$USER->id . $adminsql)) { foreach($rssfeeds as $rssfeed) { if (!empty($rssfeed->preferredtitle)) { $feedtitle = stripslashes_safe($rssfeed->preferredtitle); @@ -158,7 +166,7 @@ if ($currentaction == 'configblock') { global $act, $url, $rssid, $preferredtitle; print ''; - rss_display_feeds($id); + rss_display_feeds($id,$USER->id); print ''; //not sure that this is needed rss_print_form($act, $url, $rssid, $preferredtitle, $id); print ' |