Plug-in to limit the category (homemade)
Category: WordPress plug-in
2012-04-04 Last update:
2008-09-24: Sun Posts
To limit the category is a plug-in can post to every user.
Will be limited so as not to accidentally posted to a different category of users.
And either not be easy if you have limited a category from the beginning so that you do not register or to another category of users who are not accustomed wrong.
As a concrete image, the staff blog.
A employee is important to not only the category of A can post employees.
Function
- You can choose to allow each user category (you can select multiple).
- Posts in a category will be created only article, while editing is specified.
- It also supports the "Edit" Quick "Quick Post".
- Has added the ability to maintain a hierarchical view of the category. (Category has been selected to not come on)
- Have not set a category when posting (not check), you set the default category from the category has been limited.
Screenshot
Download
You can download it from below.
- DownLoad (2136)
Installation
- Download the zip file
- after extracting the zip file, then put it in the plug-ins folder for each folder.
- Enable the "Category Limitation" from the management screen of the plug-ins.
How to use
- Select the "Category Limitation" from "Settings" menu.
- Check the category that allows every user.
- To display all categories and all remove the check. ← This is the default setting
- If you leave the "Yes" to "to maintain a hierarchical display of categories", always to maintain the hierarchy of the category (category check does not come on).
- Save the settings by clicking the "Save Changes".
- Category will only appear later, creating articles, editing was allowed.
Other notes
That the Company is responsible even in the event of some kind of trouble is not in any way, if you try to use it at your own risk.
Update History
Added 2011-11-08:
Bugs fixed (Notice of error resolution) (ver 2.3.1)
Added 2011-07-25:
public ver2.3. That you select a category from the default category is now possible to check. If there is only one check it is the default.
In addition, support was added to remove together when you remove the plug-in option value was stored.
Added 2011-07-20:
Added a function to the default category when the category is not checked when posting the article, are limited. (If you have more than one category to get the first category is the default)
Added 2011-05-26:
Fix (Ver 2.1) a bug error of "Warning" level in the configuration screen has been generated
Added 2011-05-25:
ver 2.0 released!
Lance program has changed fundamentally. Are also available in the "Quick Edit" by it.
For more content here please refer to the announcement.
Added 2011-03-01:
Corresponding to WP3.1 (ver 1.1)
Added 2010-08-31:
Was removed (commented out) the place check of user-level waste.
Added 2010-06-18:
Added support for WordPress 3.0. Please contact us if something is wrong.
Added: 2010-02-16
"Fatal error" part was occurring and to enable the plug-in the art.
Effect is like had come out to the other plug-ins because of that.
It has been fixed, please download a new replacement.
Added: 2009-09-09
If an error occurs in the complete comment of the article, I found (which will be blank) screen does not display a defect!
Now that you have to upload things to change, please replace as soon as possible If you have not found if being used.
The ... the inconvenience.
Additional Notes:
(I want to be registered to the default category) do not have the effect of plug-in and be posted there because there's an item called "Quick Post" and later that WordPress 2.7. At the moment does not have a corresponding time, please use up to version 2.6.
Added: 2009-08-24
I tried to tentatively support.
Have to do is not visible in the style sheet also said the support (sweat) ....
The best thing is if you can and begs to hack at the time of the save, so I do not have the ability of the more unfortunately, has taken a turn off in the style sheet method "Quick Post".
After you open the settings screen "Categoly Limitaion",
What hidden force the "Quick Post"? There is an entry.
Will be;: "none display" the CSS of the object has been entered in the "element to hide" if you saved by selecting "Yes". Is an element of the "Edit" Quick "Quick Post" object has been entered by default.
I think need to be added, separated by commas if there is another element that you want to hide. If you want to add, please follow the how to specify objects in jQuery.
I think that is no escape route can also be used If you can not see Well, malfunction, and reduced to certainty.
- Tag
- WordPress memorandum , category , plug-in , limit
- Trackback URL
It can be said that [...]. However, this is the scene you want to "limit the category that can be posted by authorized internal users," such as in demand in the enterprise portal can not be used. Which might be as a plug-in instead of the plug-in "LimitCategories" not available in WordPress2.7 decides to try planning the IS's production of "Category Limitation". [...]
Download the ISO from the site's planning a [...] zip file [...]
Plug-in "Category Limitation" to limit the category of WordPress edit your posts
Are making the blog such as bulletin board to create a web site dedicated to membership in WordPress, the leak may post freely to Mr. membership in it. Only be made independent of this blog, there is no problem if you build, category ...
WordPress design a customized lessons Permalink ← WordPress login page, the admin [...]: IS planning category | Plug-ins that limit the [...] category (own).
It, except for categories of relationship can hide this blog's IS planning in the "Category Limitation", and the introduction of this [...]. [...]
Plug-in to limit the> Category memorandum [...] WordPress "Category in the (own) [...]
Program This entry was posted in wordpress. Bookmark the permalink to limit the [...] category free software attention. ← Mac OSX [...]
[...] Category limitation [...]
[...] Category Limitation http://www.is-p.cc/wordpress/plug-in/category-limit/364 [...]
Plug-in to limit the [...] Category «IS planning. (Homemade) [...]
[...] Category Limitation [...]
Introduced because there was [...]. You have also described here. Is a "category-limitation". [...]
References [...] plug-in to limit the category (own) | IS planning [...]
[...] http://www.is-p.cc/wordpress/plug-in/category-limit/364 Share this: TwitterFacebookTumblr Category: wordpress Comments (0) Trackbacks (0) by comment [... ]































Friday 2009/8/21 13:07:42
Nice to meet you, hello.
At the site here, so that a lot of information to the public who would be for you build a site in wordpress, have always let me study.
By the way, I think that seeks to allowed to use the "Category Limitation" here now,
Activate the plug-in, letter of "Category Limitation" to the list of configuration is that it is displayed, set the screen does not appear when you click on it.
What will be said ... What might be faulty. Incidentally, if you remove all the plug-ins currently used in combination, was used alone the Category Limitation, did not provide a configuration screen is displayed.
In me is using the Wordpress 2.7.1.
If version 2.7 or later, a statement to this effect in the Quick Post will be disabled category, but has been written, at least 2.7 They can not be used even if a normal post?
But the inconvenience, I am glad when your answer.
Friday 2009/8/21 13:37:33
> Thank you for your Sessaku's a mi_325!
Currently, both versions of WordPress 2.8.4 is the latest I have, they work without any problems.
What do you think is considered as a factor and you do not have the permission or not?
If you made or the administrator of the admin will do for example?
I think so I only catch (if no errors have occurred if), but ... there is a part of.
(As it has finished processing and is not the most significant user_level)
Also, do not do anything even if it does not only "admin" user to the contrary. Because you leave out the "admin" in retrieving the user since.
What does the user other than admin?
If all else fails (^ ... still - ^; What do I do?
Friday 2009/8/21 15:13:21
Thank you for your answer right away!
>> Has finished processing the most significant as it is and is not user_level
And that, the thing to try, in addition to the current admin, administrator privileges, create a user's rights has been set nine,
Look at the screen was set by changing to all administrative privileges, the setting screen of "Category Limitation" was displayed!
In addition, the (now back to the author), setting screen is displayed normally, but changes have been made to user rights again came to be safely setting screen is displayed.
Safely, is so precious in this plug-in can be introduced.
Plug-ins and great advice, thank you very much!
Friday 2009/8/21 15:24:51
> It was good that can be resolved safely be like Mr. mi_325.
I was just a little care, you need to bother everyone without administrative privileges, should be all right if the change of each user logged in as admin (for example). (Is that the authority will have nothing to do with how the user to be set if the user is an administrator privileges to make changes in short. ← It is a little hard to understand)
Now, please try if the opportunity arises.
You are looking forward to hearing from you.
Friday 2009/8/21 16:01:08
Thank you for your reply repeatedly.
>> Should be all right if the change of each user logged in as admin
Such that I, and additional plug-in, change settings and I had been always state you are logged in as admin, with administrator privileges. However, the Settings screen ... did not appear.
It was good Maybe there is a problem with something else ... but this time it was resolved by the above-described method of me for now to wordpress.
Thank you very much!
Friday 2009/8/21 16:14:41
> It is a mystery ... What was also a new three-layer mi_325.
Maybe me when you output, then it may be that turning Konekuri to change, so remember that before ... quite Nanibun.
I think so now, and try to change or turn off to force the CSS as a quick point of the post, let's review at that time.
In.
Wednesday 2009/8/26 12:36:41
Hi, hello.
Always, we ask them often come study temple.
By the way, is what Category Limitation, but does that but it works as I think, in the configuration screen
Warning: implode () [function.implode]:. Bad arguments in / xxxx / wp / wp-content / plugins / category-limitation / wp-category-limitation.php on line 381
That, Warning it will cause. But does not interfere with the operation, such as, Is there any way there will be something to put out? I am using me, the WP2.7.1.
Thank you.
Wednesday 2009/8/26 13:20:57
> Thank you Mr. purposely report komaru!
I think probably because of incorrectly error come out when you use the function argument to PHP "implode ()" called.
I tried to upload earlier, tried to fix it. I think this error is probably no longer.
お手数ですが、再度ダウンロードして使用してみていただけますか?
もし他にエラーや不具合が発生した場合はお知らせ下さい。
2009/8/26 水曜日 17:48:36
うわー、ありがとうございます。
こんなに早く対応していただけるとは思いませんでした。早速試したところエラーは出ませんでした。
本当にありがとうございました。
Thursday 2009/8/27 09:56:58
> We report here what I komaru, Thank you.
Thank you in the future.
Sunday 2009/9/13 08:49:45
Please let me visit you often ☆
Thank you for the nice plug!
Please let me have comfortable use! !
Can not be used such as the following error when you enable the plug-in I was up to Ver 2.8.4 latest version of the last Sun and I ask a sister out ...
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in / xx / wp-content / plugins / category-limitation / wp-category-limitation.php on line 37
I think that you guidance even when I'm afraid of your very busy schedule handmade.
Thank you!
Monday 2009/9/14 08:39:24
> Thank you for your trouble report says Jela.
Was troubled, that error ... This is the first time.
Error that is the way, why did not the previous 2.8.4 's version of WordPress?
PHP version of the environment in which it is or will be used after more than five?
10:10:46 Tuesday September 15, 2009
Where it has been resolved up to five the version of the PHP!!
I'm sorry I to have taken up your time by long time because it was rudimentary;;;;
Thank you ☆
Tuesday September 15, 2009 10:41:13
> How are three-layer Jela.
It was good is moved like a safe!
Thank you.
Friday November 13, 2009 16:00:26
While I think I want to raise the user-friendly, we arrived to this site.
Although I saw the download, the following error,,,
Your so good at leisure,
If you can look at is appreciated.
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in / xx / wp-content / plugins / category-limitation / wp-category-limitation.php on line 37
PHP version is greater than or equal to 5.
Wishes best regards.
2009/11/16 月曜日 17:00:29
>bipooさん返事が遅れてしまい申し訳ありません。
申し訳ついでに、先程コメントを確認したばかりですので、まだ検証をしておりません…。すいません。
これからチェックしてみますので、今しばらくお待ちください。
2009/11/16 月曜日 17:12:57
>bipooさん
(^-^; よく見ると上の方のコメントと同じエラーみたいですね。
PHPのバージョンは5以上で合っているのでしょうか?お手数ですが、もう一度確認してみていただけませんか?
Tentatively, I tried to search various, still is not found only about what would the error "can not be used with PHP5 is not greater than or equal to (const) constant ...".
Friday 2010/1/15 12:22:55
Thank you kindly published a very good plug-in.
I would instinctively put a comment.
I do I can also be applied to add a category to post this, but not limited to.
To limit the category that can be added to every user.
Can not have children only under parent category that is the limit
I realized how difficult this is?
Please consider in your spare time.
Friday 2010/1/15 16:41:10
> I'm glad your Ponpoko words, thank you very much!
I see ....
Do you mean, you do not want only to create a category in the category of their own under. What do you want to know is intended.
Such ideas are welcome!
So try it while I consider whether it is possible looking at the spare time, I hope you can leisurely wait.
Tuesday 2010/1/26 12:03:22
Hello.
Is a person before, let me questions about the use of in wordpress2.7.1 defect in the comments here. Please support us and that section early, thank you very much!
Since then, we got them used, such as wp2.6.5 may also be useful in a little old.
By the way, if you are using Category Limitation, when you log in the user because they are limited in the category, when you create the article, but has to check state has entered the category of the top from the beginning, this that you remove the can I?
To multiple users, I have posted each allocated a category of the current 2-3, respectively, often forget uncheck the top ... they've previously entered.
If you have a user limited to one category, or because it also I think it would be more convenient option is checked in advance if you would if possible, is very welcome and I enjoy such as the modifications of the script.
But the inconvenience busy schedule, I am glad when your answer.
Tuesday 2010/1/26 13:26:27
> I'm glad to mean that the now can also use Mr. mi_325.
Well, of your question is, how to remove the check in advance is easy.
Will open in a plug-in directory "wp-category-limitation.php", place the following line 101,
if (ereg ("post-new.php", $ _SERVER ["PHP_SELF"]) | | (count ($ limitid) == 1)) {
"| |" Of if you change to "&&", the category will be limited to checking only when the one to go into. (If more than one category check does not enter.)
We'd like you to be careful about one point, but they will be posted to the default category if you forget to check the category (when published) is when the update is set in WordPress however.
「更新(公開)時にデータをハックして云々」というレベルまで私の技術が無いので、お許し下さい。
2010/1/26 火曜日 15:05:47
早々にご返答いただき、ありがとうございます。
教えて頂いた箇所を直してアップしたところ、期待通りの動作をしました!
カテゴリーが1つの時はチェック有り、複数の時はチェック無し…素晴らしいです。
本当にありがとうございました!
Wednesday 2010/2/10 18:08:25
This is the default setting, but I was allowed Nice to meet DL
The state went check at an early stage or will can not do, but I think I say that braid the user who only limited Kategoi was checked to display all categories and remove all of the three. Check and can post Oh Thank you to m
Thursday 2010/2/11 11:44:49
> DL ~Tsu Kayama blood counts, thank you very much!
Well, I feel like I can hook you if you use the action of the contact is likely.
However, we do not take the hand quite busy day job a little better. I think, if you can wait leisurely If you're going if you wait here.
※ I think so (or so that there is a demand) is more important "feature to be able to add a new category that is specified only in the category" Personally, you will then.
Not immediately live up to your expectations ... I'm sorry.
Friday 2010/2/12 12:00:09
You should wait patiently ~ ~ Thank you for your reply immediately ^ ^
Tuesday 2010/2/16 11:47:25
I have been I am allowed to consider the use of "Category Limitation", we would like to discuss with you it came out that one problem can not be cleared.
Use the "Custom Field Template", has established the template of some custom fields.
I and plug-ins that are automated deployment of custom field template for each category selected, when used in conjunction with "Category Limitation" here, automated deployment of the template does not work, do not appear in the drop-down list for selection.
■ wordpress2.9
■ Custom Field Template1.5.7
■ Category Limitation1.0
Was verified by the ON or OFF or to other plug-ins, will be reproduced only if you have ON the "Category Limitation".
Here, what you can consider.
Tuesday 2010/2/16 14:01:00
> San Yusa
We consider the use of this plug-in, and thank you.
> I such plug-ins that are automated deployment of custom field template for each selected category,
So with that, I guess a bug in that area.
Sessaku will be rewritten so that the last guess that is displayed (categories) data, it would erase the data that was written by "Custom Field Template" at that point.
Was examined on tentatively, to tell you if there is a workaround. If you are sorry ... so bad.
Tuesday 2010/2/16 17:18:58
> A result of examining Mr. Yusa, there was a place that is experiencing the "Fatal error" part of this plug-in.
I neglected the error checking so if everything was working normally. Ah, embarrassing!
Sorry to trouble you, but because the current one has been uploaded, modified, please try to replace the download again.
Thank you pointed out.
Wednesday 2010/2/17 10:52:28
Busy schedule, Thank you for your prompt response!
Now both can be used safely.
下 Sari offers a very convenient plug-in also,
Thank you.
Friday 2010/2/19 09:30:57
> I appreciate because I was able to fix the potential problem here's what Yusa.
Once along the demand was made to use, please use us.
Tuesday 2010/5/18 14:52:38
Thank you for a great plugin.
I looked for some plug-ins overseas, I like it like that so here is a simple and stable.
(In domestic deals!)
By the way, has to be posted to all categories by default, in such a setting can not post or by default will not be able to reverse.
Because the site can register free account, It is better by default can not post.
Kindly let me know rather than from the setup screen or can be posted only unclassified addition, if you are available in the rewriting of the script.
Thank you.
Tuesday 2010/5/18 16:52:13
> Thank you for your sea Hoyo what's here.
I am so good at English, we Gattsuri written in Japanese so that they are not questions in English (sweat).
Now, I called "no longer be posted by default" is a review of your question, but I do not know what has been said up to where, "If you have not set anything, you can not itself post" If you did it that , I think I would not force this plug-in below with modifications in its own way.
"If you default, to display only (such as unclassified) initial category" If If you're going, where is possible if the following rewrite wp-category-limitation.php.
■ If more than wordpress 2.9, change the line 469.
$ Selected_cats_str = ";
↓
'(Such as unclassified category id) id of the category' $ selected_cats_str =;
■ If it is less than wordpres 2.9, change the line 517.
$ Selected_cats_str = ";
↓
'(Such as unclassified category id) id of the category' $ selected_cats_str =;
Once id had an unclassified category, for example,
$ Selected_cats_str = '1 '
(OK maybe not exactly, but clearly have not tried it) and rewrite it, should not only appear in that category probably ... is.
I think you can afford by any change in the update frequency of this plug-in is not so very little. ← is not proud.
Tuesday 2010/5/18 18:03:03
Thank you for your early reply!
Lack of explanation ^ ^ I'm sorry;
Condition is checked only category of "Unclassified", user is created in the stage is desired.
I tried immediately, we will no longer appear only unclassified management screen.
What how.可能でしょうか。
お忙しいところすいません。
Thank you.
2010/5/19 水曜日 08:49:45
>うみおよさん
(^-^; 申し訳ありません!
やっぱり何となく「こうじゃないか?」でやるとダメですね…。自分が書いたはずなのに忘れてます。
で、ちゃんと探しましたので下記のように変更してください。
wp-cagetory-limitation.phpの102行目、
if(count($limitid) > 0) {
↓
if(count($limitid) == 0) $limitid = array(1);
と変更します。 (「1」にはデフォルトのカテゴリidを入れていきます。2つ以上の場合は array(1, 4, 5)とします。)
それと133行目の、
}
を削除します。
By changing as described above, a new (limited to the category has not been set) to prevent the user can display only a particular category when submitting the article.
Please try - (^ o o ^).
Wednesday 2010/5/19 10:10:25
Great!
迅速な対応と技術力に感動致しました! !
もうなんとお礼を言ったらいいのか・・・
今日明日中になんとかしなくてはいけない状態だったので、本当に助かりました。
今後もご活躍&このプラグインの強化版を期待しております。
Wednesday 2010/5/19 12:02:08
> It was good is like the sea was in time for your budget.
Technical capabilities of both honest I do not have that much. I think the program has come out with suggestions for improvement if we look at color is probably the leading programmer.
I think the most important because it is "that a user or customer satisfaction", was satisfied in terms such as here but is also happy.
Friday 2010/7/16 16:18:54
Nice to meet. We have been using the plug-in "Category Limitation" very nice for the user. Thank you for always.
I have a question to our IS planning.
To ensure that, post editing screen which can be selected in a non-category that is selected in the "Category Limitation" What do I like?
For example, suppose you have a child-parent category as follows.
Memo - · wordpress
- · Php
I want to get rid of child labor category of category "notes" because the parent will any increases, that increases every selection.
If you have your time, I hope you can answer.
Thank you.
Friday 2010/7/16 16:42:07
> We use our plug-in acid equivalent Kai, thank you very much!
> Becomes available other than the category selected in the post editing screen that is selected in the "Category Limitation"
What it is that so far?
This plug-in is that it is intended not edit posts to be displayed on the screen other than the category that is selected ... (^ - ^;
> I want to get rid of child labor category of the category "notes" because the parent will any increases, that increases every selection.
Mmm .... I do not understand this a little makes sense, what means, I want to always select a category of one any chance?
Friday 2010/7/16 20:36:05
I'm sorry I did not have a description Tsutanaku.
> This plugin is intended to be displayed on the screen not edit posts other than the selected category
とは逆に、選択されたカテゴリー以外を投稿編集画面で表示させる。ということをやりたかったのです。
自分でソースを編集しようと試みたのですが、あえなく断念して、神頼みをしたしだいであります。
2010/7/19 月曜日 09:29:36
>カイさんなるほど、逆の場合ですか。
恐らくそれは簡単だと思います。
「wp-category-limitation.php」ファイルの中の519行目の以下の箇所を変更してください。
'include' => $selected_cats_str
↓
'exclude' => $selected_cats_str
これで選択されたカテゴリ以外を表示させるはずです。 (WordPress 3.0の場合)
WordPress2.9の場合は、575行目の以下の箇所を変更します。
include=$selected_cats_str
↓
exclude=$selected_cats_str
要するに「include」を「exclude」に変えれば逆の事になります。
以上、お試し下さい。
2010/7/20 火曜日 10:28:06
wordpress 3.0で試しました。
成功です! ! Thank you! ! !
これでカテゴリーが増える度にチェックするという煩雑な作業がなくなりました。
まさか、これほど早くご対応して頂けるとは思いませんでした。 ISプランニング様、本当にありがとうございました。
2010/7/26 月曜日 21:22:02
We indebted.
Wordpress3.0日本語環境下で、特定ユーザーに投稿者権限を与え、ログインした時に「ブログ」カテゴリーのみ表示させたいと、探し回ってやっとここにたどり着きました。
全く同じコンテンツのローカル環境(xampp)では素晴らしかったのですが、いざサーバーでプラグインを有効化しようとした時に、
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/cmsjapan/cmsjapan.jp/public_html/wp/wp-content/plugins/category-limitation/wp-category-limitation.php on line 42
Has become.
他のプラグインを全て無効にして一旦ログアウトしてから、異なるブラウザでログインして試しましたが同じでした。 line 42 の ” を ' に変更して試しましたが、これもやはり。
御検討いただけますでしょうか?
Thank you.
2010/7/27 火曜日 08:07:56
>のろさんご使用いただき、ありがとうございます。
全く同じエラーのご報告が以前のコメントにもありましたが、恐らくそれはPHPのバージョンによるエラーだと思います。
PHPのバージョンが5である事をまずご確認いただけますか?
2010/7/27 火曜日 13:40:34
以前のコメントに同じ質問があるのに、大変失礼いたしました。
てっきり PHP4 → 5 は済ませたと思い込んでました、感謝!
それで、有効化していざ 設定 → Category Limitation と進んだら
設定を行なえる権限がありません!
管理者でログインし直してください。
と表示されてしまいました、他のユーザー設定していないのに。他の全てのプラグインを無効化してログアウトし、ブラウザを変えてログインしても同じ、一旦削除し再アップロードしても同じでしたので、新たに「管理権限を持つユーザー」を新設してそちらから行ったらOKでした。・・・?
取り急ぎ御報告まで。
環境:wordpress-3.0-ja / PHP V-5.1.6 / MySQL v-5.0.77
2010/7/28 水曜日 08:31:40
>のろさんどうやら管理者の権限で多少おかしな挙動があるみたいですね。
全員が同じ症状であれば治しやすいのですが、一部の環境となると再現が難しくてなかなか原因が掴みにくいです…。
「権限がありません」という事はuser_levelのチェックをしている箇所なので見直してみたのですが、別段外れた事はしていませんでした。
(^-^; 何かバグが潜在的に潜んでいるというのは嫌ですね。
2010/7/29 木曜日 11:55:17
WordPressで構築したブログを複数ユーザで投稿ユーザごとに投稿できるカテゴリを限定
他のCMSでは容易に実現可能なこの仕様が
WordPressでは意外にもなかなか実現できず、困っていました
管理人様のcategory-limit はそんな状況において、本当に助けられました。
大変便利なプラグインで今では重宝しております。
Thank you.
2010/7/29 木曜日 15:21:12
>b_bさんお使いいただき、ありがとうございます。
確かに誰もが欲しがる機能だと思うのですが、なぜWordPressには無いのでしょうか?不思議ですよね。
今後ともどうぞ宜しくお願いします。
2010/8/25 水曜日 03:36:06
Nice to meet you.
Wordpress3.0.1を先日よりカスタマイズ中です。
ユーザーが多いのでカテゴリ毎の投稿制限をしようと調べていてISプランニングさまにたどり着きました。
早速プラグインをアップしてみたのですが、設定画面で下記のエラーメッセージが表示されました。
Fatal error: Call to undefined function get_nested_categories() in /***/plugins/limitcats.php on line 233
自分で修正をかけようとプラグインを開き該当行を確認したのですが、書かれているのはhtmlソースで何がおかしいのかわかりません。
よろしければご教授お願いいたします。
2010/8/25 水曜日 08:08:32
>おのひろさんそのエラーは「get_nested_categories()」というfunction(関数)が見つかりません、という意味です。
ですのでlimitcats.phpというファイルの中で「get_nested_categories()」を探して定義されているか、他のファイルで設定されている場合、そのファイルを読み込んでいるかを確認してください。
ちなみに、恐らくそのプラグインは私共のとは全く違うものだと思いますが…。
「get_nested_categories()」という関数は使っていませんし、そもそも「limitcats.php」というファイル名ではありません(デフォルトではwp-category-limitation.phpというファイル名のはずです)。
それとも何かしら同じような機能のものを使用されていて、関数名で衝突とかしているのでしょうか…。
2010/8/30 月曜日 15:20:02
こんにちは。便利なプラグインありがとうございます。
実は2010/7/27 投稿の、のろさんと同じ症状がでて、同じ解決策で使えるようになりましたので、ご報告します。
インストールまではエラーも出ずうまくいったのですが、adminでログインしているにもかかわらず
設定を行なえる権限がありません!
管理者でログインし直してください。
のメッセージが表示され困っておりました。
こちらの投稿を順に試して、のろさんの方法で、
既存のユーザーを管理者に変更してそのユーザーでログインしたら無事に設定画面が表示されました。
まるでwordpressで初期設定されたadminは無視されているかのような挙動です(?)。
ともかく、便利なものをありがとうございます。
使えて本当に嬉しいです。
同じように困っている(おそらく少数の)方がいたらお試しください。
wordpress var2.9.1 /php 5
2010/8/30 月曜日 16:00:01
>なまけものさんご利用ありがとうございます。
> まるでwordpressで初期設定されたadminは無視されているかのような挙動です(?)。
そうですか…。
何人もそういった症状が出るという事は何か問題があるのかもしれませんね。
恐らくプラグインの234行目で行っているユーザーレベルのチェックがちゃんとされていないのが一番の原因だと思います。
そもそも173行目のadd_option_pageで既にユーザーレベルを限定しているので外して良いかもしれません。 (無駄な事をし過ぎてる?)
ちょっと検討させてください。
2010/8/30 月曜日 18:17:27
早々のお返事ありがとうございます。
>ユーザーレベルのチェックと見て、はっと気付いたのですが、権限をいじっているプラグインをもう1つ使っています。
私が少数派になってしまったことと関係あるのかわかりませんが、情報を小出しにする形になってしまい申し訳ございません。
使用中のプラグイン
Hide Admin Panels
今のところ両立して使えているので(adminは相変わらず無視されていて設定を行なえる権限がありません!
管理者でログインし直してください。
が出ますが)
特定のユーザーのカテゴリを非表示にするという動作には特に問題はないです。
2010/8/31 火曜日 09:29:52
>なまけものさんいえいえ、こちらこそ情報ありがとうございます。
早速そのプラグインをダウンロードしてインストールしてみたのですが、やはり再現しませんでした…。もっと細かい設定による影響でしょうか。
ただ、役に立っているとは言えない(無駄な?)箇所をコメントアウトしましたので恐らく管理者(admin)でも行えると思います。
お時間がある時でも再度ダウンロードして差し替えてみてください。
2010/8/31 火曜日 16:03:52
ISプランニング様、ありがとうございます!
差し替えてみましたところadminでも認識してくれるようになりました!
Hide Admin Panelsとも共存しております。
(もしかして当方のプラグインの使い方に間違いがあったのかとも思って、今、冷や汗です。)
本当にお礼のしようもないくらい感謝です。
Thank you.
2010/8/31 火曜日 17:07:20
>なまけものさんとりあえず上手くいって良かったですね。
なぜ環境によってユーザーレベルが上手く取れないのか、謎が残りますが…。
こちらこそ今後とも宜しくお願い致します。
2010/11/1 月曜日 20:27:50
Nice to meet.
とても素晴らしいプラグイン「Category Limitation」を使用させて頂いております。
いつも感謝いたしております。
ISプランニング様に質問がございます。
モバイルからの投稿時、予め決められたカテゴリーに投稿される。という動作はできるのでしょうか?
ちなみにモバイルからの投稿は、「ktai_entry」プラグインを使用させていただいた降ります。
何かソース上をカスタマイズしたら可能でしょうか?
お忙しいとは思いますが、ご助言お願い致します。
2010/11/2 火曜日 08:56:03
>まさとさんご利用ありがとうございます。
当方はKtai_entryを利用した事が無いのでよく分からないのですが、確かモブログですよね? (Ktai_styleは使用した事があります)
だとすれば、こちらのプラグインでどうこうというのは難しいと思います。
恐らく「携帯でメール投稿」→「Ktai_entryで自動投稿」という流れだと思いますので、入り込む余地は無いかな、と。
やるのであれば「Ktai_entry」の自動投稿(更新)の箇所を改造するしかないでしょう。当プラグインの情報は「get_option(“isp_cat_limit_options”)」で取得できるのでそれで何とか…という所でしょうか。
(ただし今後のバージョンアップの事を考えてもあまりやるべきではないと思います。)
先程プラグインの正規ページを見ましたが「カテゴリー指定 (複数カテゴリーに対応) およびキーワードタグの付与が可能です。」とありますので、現状それでやってもらうしかないように思われます。
お役に立てず申し訳ありません。
2010/11/2 火曜日 10:12:06
早々のご対応感謝いたします。
なかなか難しいみたいですね。
もう少し調べてみます。
Thank you.
2010/12/11 土曜日 16:54:34
以前から「Category Limitation」を便利に利用させていただいております。
とても感謝しています。
私が以前に取得したバージョンから2回ほど改修されているようですが、
ファイルの中身を確認すると最新のものもバージョンが1.0となっています。
可能でしたら、改修時にはバージョン表記も上げてくださいますと幸いに存じます。
今後とも、どうぞ宜しくお願い致します。
2010/12/13 月曜日 08:30:22
>よっちさん大変申し訳ありません!
公式(サイト)で公開していない野良プラグインという気安さから疎かになっておりました。
確かにそれを目安にアップグレードされる場合もありますよね。
今後バージョンアップの際にはしっかりとバージョン表記を上げていきますのでどうぞ今後とも宜しくお願い致します。
2011/1/28 金曜日 00:55:33
すばらしいプラグインですね^^
ひとつ思ったのがクイック編集には便利な機能もあり、逆に不要なメニューも混在しているので、不要なメニューのみdisplay:none;を指定できればより使い勝手が向上しそうな気がします。
クイック編集内の要素にはデフォルトでは固有idや固有classやらが振られていないものがあり、jqueryから要素指定ができないので、クイック編集内の各要素にあらかじめidを振り分ける機能をつけるのはいかがでしょうか?
2011/1/28 金曜日 08:43:18
> magicさんコメント、ありがとうございます。
クイック投稿の件は頭を悩ましています。
そもそも何故クイック投稿を非表示にするかというと、投稿した時点でデフォルトのカテゴリーに全て入ってしまうので「Category Limitation」の存在意義が無くなってしまうからなんです。
保存後にカテゴリーデータを変更できれば解決できそうですが、以前ちょっと調べたところ上手くいきそうになかったので「とりあえず非表示にしてしまえ。」という後ろ向きな解決に至ったわけです。
恐らくそれなりに解決方法はあると思うのですが、あれから全然調べていないのでいまだ未解決のままです。
という根本的な問題がありますのでご理解いただければ、と思います。
いずれ解決はしようと思ってますので、気長にお待ち下さい。
2011/1/29 土曜日 10:09:31
マルチサイトにしないで、模擬的にでもプログを何個か開設したいと思ってプラグインを探していました。 「Category Limitation」が目的にぴったりです。ご提供ありがとうございます。
少し質問があります。
投稿画面のカテゴリー表示上で、Aさん向けの親子のカテゴリーの間にBさん向けのカテゴリーが割り込んで表示されたり、親子のカテゴリーが階層表示されないでフラットに表示されたりすることがあります。
親カテゴリー名が異なっても子カテゴリー名が同じ場合があるので、AとBに投稿できるCさんのときはAかBの子カテゴリーか区別が付かず困ったことになる場合があります。
利用上のコツとか、カストマイズのことで何かアドバイスがあればお願いします。
2011/1/31 月曜日 09:17:31
>typelogさんご利用ありがとうございます。
>投稿画面のカテゴリー表示上で、Aさん向けの親子のカテゴリーの間にBさん向けのカテゴリーが割り込んで表示されたり、親子のカテゴリーが階層表示されないでフラットに表示されたりすることがあります。
これはどういった事でしょうか?
Aさんが「A,B」カテゴリーを選択しながら「C」というカテゴリーも表示されてしまうという事でしょうか?だとすればちょっと問題ですので詳しい状態(設定内容)を教えていただきたいのですが…。
階層表示の件ですが、例えば子カテゴリーのBが既に選択されてある状態、とかでは無いのでしょうか? WordPressの投稿を見る限り、選択されたカテゴリーは親子関係に関わらず列のトップにきています。
↑こういう単純な問題ではなく、ですか?
> 親カテゴリー名が異なっても子カテゴリー名が同じ場合があるので、AとBに投稿できるCさんのときはAかBの子カテゴリーか区別が付かず困ったことになる場合があります。
これはちょっと難しいと思います…。
解決策としては親カテゴリーも選択に入れるしかありませんが、前述のように既に選択されているカテゴリーは親子関係から外れてしまいますし、間違えて親カテゴリーを選択する可能性もあります。
typelogさんの方で名前を変更する等、何らかの対処をしていただかないといけないかなぁと思います。
当プラグインが行える大原則は「投稿時に選択されたカテゴリのみを表示する」というのみです。それを踏まえた上で上手く活用していただければ幸いです。 (^-^)
2011/1/31 月曜日 22:09:04
Thank you for your reply.
はしょった投稿が混乱の元でした。ひょっとしたら当方のみの現象かもしれません。
少し具体的に。二つの親子カテゴリを定義しています。
Category 1
A
B
C
Category 2
X
Y
B
とした場合、トラさんの投稿画面へは次のように表示されています。もちろんトラさんには二つのカテゴリ親子ともども投稿を許可しています。
A
X
Y
B
B
C
カテゴリ2は階層表示されていますが、カテゴリ1はフラット表示で、カテゴリ2に割り込まれています。
どのBがどちらの親カテゴリに属するかは分かりますが。
カメさんにカテゴリ1の投稿だけを許可すると、カメさんの投稿画面のカテゴリ表示は以下のようにフラットになってしまいます。
A
B
C
こんな状況ですが、こちらの特殊事情かも知れませんので、WoedPressを再インストールしたりしてみます。
2011/2/1 火曜日 09:51:26
> typelogさん恐らくですが、その時に「A」というカテゴリーは選択されている(チェックが入っている)のではないでしょうか?
もしそうであるなら、それはWordPressの仕様なので直らないと思います。
前述した通り、選択されたカテゴリーは親子関係に関わらず一番上に表示されるようになります。もし「A」が選択されている状態であるならば、上記のような現象になると思います。
これを直そうとしたら、WordPressの関数を変更する必要があると思います。
(確かにこの仕様は少し不便ですよね…。)
2011/2/1 火曜日 14:33:32
毎度、申し訳ありません。
確かにAをデフォルトの投稿先カテゴリーにしています。
Category Limitationの設定画面やサイドバーウィジットのカテゴリー表示ではAを先頭に二つのカテゴリーとも階層表示されているので質問した訳です。
投稿画面のカテゴリー表示は別とのご指摘、WordPressの仕掛けも分からずの質問でした。
大変ありがとうございました。
2011/2/3 木曜日 11:44:06
確かに不便というか、?なことです。
投稿画面でも、親子のあるカテゴリは親子を離れ離れにせずまとめて表示し、かつ親子の階層で表示してほしいものですね。
2011/2/3 木曜日 12:52:29
> typelogさん出力の仕方を変えてくれると良いんですけどね。
ちなみに設定画面の方は自前で出してるから親子関係が崩れていないんだと思います(多分)。
2011/2/3 木曜日 21:28:39
ISプランニングさん自前のは親子が生き別れにもならず、きれいな階層表示ですね。
自前ではないサイドバーでは親子カテゴリーもちゃんと階層表示さています。全く、残念。もはや愚痴。
「Category Limitation」でマルチサイトにしないでもブログを何本か立てられますから、投稿ユーザーが限られる内輪のブログで便利に利用させていただきます。
2011/3/2 水曜日 02:55:00
以前コメントさせていただいた者です。
先ほどWP3.1にアップグレードしたらPHPエラーになったので飛んできました。
早速の対応バージョン公開ありがとうございます。
本当に素晴らしいプラグインだと思います。
2011/3/2 水曜日 08:06:05
>よっちさんこちらこそ当プラグインのせいでエラーが発生してしまい、大変申し訳ありません。
これからも宜しくお願い致します。
2011/4/9 土曜日 00:13:57
Nice to meet you.
複数の部署の人が1つのブログで投稿する際に自分の担当カテゴリーのみ投稿できるようにというのでプラグインを探していてたどり着きました。 Thank you.
質問なのですが2点あります。
1)ある担当(投稿者)のIDで入った時でも、Press Thisを使うと違うカテゴリーでも投稿出来てしまうようなので、それを回避する方法はないでしょうか?
2)後で決裁者が確認した上で投稿できるようにその担当者の投稿を必ず下書きで保存させるようにはできないでしょうか?
プラグイン自体の質問ではないものもあるかと思いますが、何か良い方法があればご教授ください。
Thank you.
2011/4/11 月曜日 08:55:39
>amameさんご利用ありがとうございます。
一つ目の質問ですが、他のプラグインとの兼ね合いになるとこちらでもちょっと対応が難しいですね。独自で色々やってる場合もあるので…。これは解決できないと思います。
2つ目ですが、これもちょっと機能外になります。
恐らくそれ用のプラグインを作成した方が早いかな? I think.
例えば、パっと思いつく一番簡単な方法は、投稿画面の表示の時にユーザーレベルを調べて一定以下ならスタイルシートを利用して「公開」ボタンを表示させない、とか。
どちらにしろ当プラグインでは難しいです。
あくまで「投稿管理画面で選択できるカテゴリーを制限する」だけのプラグインですので…。
2011/5/24 火曜日 13:28:41
ご無沙汰していました。
「wp-category-limitation.php」というファイルの465行目、$checked_ontop = true の箇所を $checked_ontop = falseにするだけですね。
確かに投稿画面のカテゴリー階層が親子水入らずできれいに階層表示されました。
これは2月始めにISプランニングさんと応答した件ですが、ISプランニングさんのフォローの丁寧さには望外のありがたさです。
ブログの書き手にはさらに分かりやすくなりました。もう言うことはありません。便利に利用させて頂いています。
2011/5/24 火曜日 16:16:27
>typelogさんこのプラグインは力技により実現しています。
意外に需要があるので、もう少しWordPressのルールに則った書き方でないと拙いなぁと思っておりました。
この度、少し時間が空いたので色々見直していたのですが、以前ご質問された内容の解答がそのまま転がっていたので、お知らせしておこうと思いました。
(滅多にこちらを覗かないだろうと思い、直接メールさせていただきました)
近日中には、もう少しまともなバージョンがアップされると思いますので、そちらに差し替えていただければ、と思います。
2011/5/25 水曜日 11:39:02
実装したいことが簡潔にできました。 Is the best! Thank you!
環境:WordPress 3.1.2
2011/5/25 水曜日 12:03:10
>hidelowさんお役に立てて何よりです。
是非ご活用下さい。
2011/6/20 月曜日 09:52:48
最新版にアップデートしました。
マルチサイトにするまでもなく、これで小グループの筆者交代ブログなどに簡単、最適なブログサイトにできます。
Thank you.
2011/6/20 月曜日 10:25:34
>typelog さんこちらこそアップデート版、ご利用ありがとうございます。
私もちょっと学んで、階層表示を取り入れました。自分でも納得しております。
(実はこれが無ければもっとスッキリしたコードになるのですが(汗)…)
2011/6/20 月曜日 14:28:40
カテゴリーを設定しないで投稿すると(よくありそう)許可されていないカテゴリーに入ってしまい、「あれ?どこ行った」の対応。
「カテゴリー未設定投稿仮置」とかのカテゴリーを作って、それを投稿設定でカテゴリーの初期値にしておくと、後の編集投稿のときに分かりやすいようです。
投稿ユーザーにも納得できますね。
2011/7/2 土曜日 13:07:10
初めましてカテゴリーを制限するプラグインを探していてこちらにたどり着きましたとても素晴らしい機能なのでぜひ使いたいとおもっているのですがプラグインをインストールして有効化をしたところ
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /*******/wp/wp-content/plugins/category-limitation/wp-category-limitation.php on line 41
と出て有効になりませんでしたよろしければ解決方法を教えていただけないでしょうか
wpのバージョンは3.1.4になります
Thank you
2011/7/4 月曜日 07:57:56
>wpsabuさん恐らくPHPのバージョンが引っ掛かってるのではないでしょうか?
PHPのバージョンが5である事をご確認いただけますか?
2011/7/4 月曜日 13:35:23
PHPのバージョンが4でした。
PHPのバージョンを5に変更したら無事に有効有効化になりましたありがとうございました。
2011/7/20 水曜日 09:44:43
> typelogさん
ver2.2よりデフォルトのカテゴリーがチェック(制限)されたカテゴリーになるように変更しております。
2011/7/20 水曜日 22:40:21
素晴らしいフォローに感謝します。早速ver2.2を適用しました。
例えば、Aさんのブログ向けに以下のようにカテゴリーと制限を定義。
親 Aさんのブログ すべて (チェックなし)
子 未分類 (チェック)
子 野球 (チェック)
子 サッカー (チェック)
子 ゴルフ (チェック)
もし、カテゴリー定義で子の未分類が一番上に来ないときはカテゴリー順番変えプラグインで一番上に持ってきて投稿時カテゴリー設定忘れのデフォルトカテゴリーにできました。
もうこれで完璧なようです。 Thank you.
2011/11/4 金曜日 12:13:15
ユーザー権限で新規投稿・投稿編集の際、Noticeが出てしまうのですが、
私の環境だけでしょうか?
Notice: Trying to get property of non-object in /*****/category-limitation/wp-category-limitation.php on line 105
2011/11/4 金曜日 13:11:03
>Mao さん先程、投稿者として編集画面を開いてみましたが私の環境では問題ありませんでした。
エラー内容を読むと「105行目でオブジェクトではないデータを取得しようとしている」的な感じでしょうか。
現在、他の方からの報告はありませんが、もし宜しければ修正版を作成してメールを差し上げますがどうでしょうか?ご確認後、問題ない場合は少しバージョンを上げて公開しようと思います。
もし抵抗があるようでしたら、こちらで事象を確認できないので修正するのは難しいです(確認ができないので)。
2011/11/4 金曜日 20:21:34
ISプランニング さんお返事ありがとうございます。そうして頂けるとありがたいです。
このメールアドレスにお送りください。
テストしてご報告させていただきます。
2011/11/8 火曜日 11:40:33
ISプランニング さんありがとうございました ^ ^
2012/1/12 木曜日 11:11:23
PHP4の状態でなんとかこちらのプラグインを稼動させることはできないでしょうか?
お客様の都合上PHP5の環境に変更できません。
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/lcvirtualdomain/nposhifa.net/htdocs/wp-content/plugins/category-limitation/wp-category-limitation.php on line 41
プラグインを有効化すると上記のエラーがでてきました。
他のサイトで使用させていただいていた時はPHP5の環境だったので問題なく使用できていたのですが、お客様の都合でサーバを乗り換えたらPHP4でした。
また、私自身がPHP知識不足というのもあり、困っています。
PHP4で稼動する同じようなプラグインもなかなか見つけられずで・・・。行き詰まってしまいました。
2012/1/12 木曜日 11:29:13
>takaさんこのエラーは確かPHP4では定数constが使えないが故に出るエラーだったと思います。
忙しいのでこちらで対応というのは難しいのですが、「wp-category-limitation.php」ファイルを以下のように修正していけばいけると思います。
A. 41行目の「isp_cat_limit_options」をコピー2. 41行目の「ISP_OPTION_NAME」が使われている箇所を検索3. 「self::ISP_OPTION_NAME」をコピーした「isp_cat_limit_options」に変更4. 42~44行目まで繰り返す5. 41~44行目をコメントアウト(もしくは削除)
※3番目の変更ですが具体的に一例(282行目)
update_option( self::ISP_OPTION_NAME, $this->myOptions );
↓
update_option( “isp_cat_limit_options”, $this->myOptions );
Please do its best.
2012/1/12 木曜日 14:09:03
早急にお返事いただきありがとうございました。
書き込みの通リPHPを修正したところ、PHP4で問題なく稼動しました。
2012/3/28 水曜日 13:50:25
ご無沙汰しています。いつものサポートに感謝しています。
ところで、最近、書き手としての会員登録を自動化し、登録してくるユーザーにデフォルトの投稿許可カテゴリーを自動で割り付けたいと思っています。
デフォルトユーザーを作り、そこにデフォルトの投稿許可カテゴリーを設定しておき、新たに登録してくるユーザーにはそれをコピーすればいいと考えています。
同様な予定があるとか、どの程度の難易度が低いときは当方でも対応できるのか、ヒントをいただければありがたいです。
2012/3/29 木曜日 09:00:20
> typelogさんなかなか難しい事をなされようとしていますね。 (^-^;)
当社の場合は社内システムとか依頼されたHPの作成という個人での運用が主なので、そういった不特定多数のユーザーに対する処理というのはあまりしませんのでイメージが沸かないですね。
当プラグインを利用する場合、ザッと考えると、アクションフックの「user_register」を利用する方法が手っ取り早い気がします。 (参考: http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
新規ユーザーのIDが取得できるみたいなので、当プラグインのデータを呼び出して書き換えて更新すれば良いかな、と。
うん、わりと簡単かもしれませんね(user_registerが望み通りだと仮定して…)。
2012/3/29 木曜日 14:23:17
Thank you for reply.
お聞きした機能が必要な局面は、管理者が不在の間に投稿されたくないカテゴリーへの投稿を防ぐ目的です。後でゆっくりそのユーザー向けのカテゴリーを設定するのが前提です。
ヒントありがとうございます。ちょっと塀が高そうですが、トライしてみます。後でこの件の報告がなければ「挫折」ですが、代案はユーザーの自動登録承認を止めて、管理者承認にすればいいことですが。
2012/4/3 火曜日 18:12:24
こんにちは。
足掛け4年に渡ってこちらのプラグインを愛用させて頂いております。バージョンアップの度にどんどん快適になり、感動しています。
また、以前こちらで何度か質問をさせて頂いた際は、丁寧にご対応いただきありがとうございました。
さて今回お尋ねしたいのは、こちらのプラグイン(Category Limitation)と、他のプラグインとの干渉についてです。
現在、複数の投稿者が存在するサイトを運営しており、PCからの投稿の際はCategory Limitationを利用してユーザー毎に投稿できるカテゴリ―を制限しています。
これと同時に、WPへメールで投稿する際のデフォルトカテゴリ―をユーザー毎に指定するため、『Ktai Entry』と、さらに『Bind user to category』というプラグインを有効にしたところ、PCから投稿する際、それぞれのユーザーがどのカテゴリ―を選択しても、Category Limitationの設定画面で指定したデフォルトのカテゴリ―で投稿されてしまいます。
CategoryLimitationとKtaiEntryだけを併用していた時は、上記のような不具合は発生しませんでしたので、問題はBind user to categoryだと思うのです。
他のプラグインとのことでこちらにお尋ねするのは筋違いかもしれないのですが、何か解決のヒントなり頂けますとありがたいです。
使用しているWP・プラグインのバージョンは以下の通りです。
WordPress:3.1.1
Category Limitation:2.3.1
Bind user to category:0.2b
(Ktai Entry:0.9.1.2)
お忙しい中恐れ入りますが、どうぞよろしくお願いします!
2012/4/4 水曜日 09:55:02
> mi_325さんいつもご利用ありがとうございます。
ご質問の件ですが、「Bind user to category」と干渉していそうな箇所を調べましたが、恐らく、というか間違いなく「category_save_pre」のフィルターフック関数が原因だと思います。
これは「選択されたカテゴリーを保存する前に実行する関数」ですが、どちらにもそのフィルターフックがあります。
多分、「Bind user to category」→「Categoly Limitation」の順番で実行され、後で実行される当プラグインが「制限されているカテゴリーが選択されているから排除→選択されたカテゴリーが無いからデフォルトを使用」という判断をしているのだと思います。あくまで憶測なので正しいかどうか分かりませんけど。
ただ問題となる箇所は上記のフィルターフックで行う独自関数なのは間違いありません。
「Bind user to category」がどういう仕組みなのか、フィルターフックによりどんなIDを返しているのか?を調べればより詳しく調べられるかもしれません。 (「print_r」なんかを使って配列を調べたりすれば分かりやすいと思います)
また、実行順序に問題がある場合はadd_filter関数で実行する優先順位を変えてみるのも手かもしれません。
では頑張ってください(^^)
2012/4/21 土曜日 20:32:31
登録してきた新入りのユーザーにあらかじめ決めておいたデフォルトユーザーと同じ投稿許可カテゴリーを与える件ですが、挫折。
ユーザー登録時にフックしてそのユーザーIDに、読んできたデフォルトユーザーのカテゴリをコピーして保存すればよさそうですが、敷居が高くでだめでした。
Category Limitationの標準機能になることを期待しています。
2012/4/24 火曜日 09:18:22
>typelogさんそうですか、諦めましたか(^_^;)
当プラグインの標準機能にしてもあまり需要は無さそうなので、当面それは無いと思います。申し訳ありません…。
ちなみに挫折との事ですが、私なりに前回でコメントした思いつきのやり方を一応挙げておきます。試していないので上手くいくか分かりませんが、もし改めてチャレンジされるなら参考にしてください。
A. user_registerを利用して独自関数を用意(functions.phpに書いても(多分)大丈夫
function function_name($user_id) {
/* your action */
}
add_action( 'user_register', 'function_name');
Two.関数の中でCategory Limitationのデータを呼び出す(上のfunctionでいくと/* your action */の後)
$val = get_option(“isp_cat_limit_options”);
Three.新ユーザーのデータを追加して保存し直す(当プラグイン「wp-category-limitation.php」の280行目にデータ形式が書いてあります
/* デフォルトのカテゴリーIDが20の場合
$val .= '&'.$user_id.'=default_20′;
update_option( “isp_cat_limit_options”, $val );
多分、上記で大丈夫だと思います。 (コメントを除くと3行でいけるかな、と)
ご理解していると思いますが、注意していただきたいのはプラグインのデータを弄るので下手をするとプラグインが動かなくなる可能性があります。まずはテスト用で試したりするのが無難だと思います。