WPCA has slowed down considerably

Accueil Forums Main plugin support WPCA has slowed down considerably

Mots-clés : 

20 sujets de 1 à 20 (sur un total de 25)
  • Auteur
    Messages
  • #696471
    paul_oneill
    Participant

    Hello,

    Expected Behavior
    Describe what you are trying to do or what you expect to get.


    We installed WPCA and the Smart Groups extension back in 2016 and it has worked well until recently.

    Current Behavior
    Describe the behaviour you got instead of the expected result.


    Now that we have been using WPCA for 4 years it has gotten really , REALLY slow.
    The way it is used is to store and retrieve clients’ reports according to their Smart Group setting.
    Late last year clients started to report timeout issues so we moved to a VPS.
    This eliminated the timeouts but the system is still too slow and some clients have gone elsewhere because of this… 🙁

    Possible Solution
    If you found one, describe your fix/workaround.


    We moved from shared hosting to a VPS, fully expecting this to fix the problem.
    It only improved the system so it no longer timed out, but still took several minutes to return results.
    The system is still essentially unusable.

    Steps to Reproduce
    List the steps necessary to reproduce your problem


    1. Log in as a client – you automatically go to “My Files”
    2. Wait. Time passes…
    3. After as much as 5 minutes, you will likely see your files – unless you are a “busy client” and literally have 100s of files

    Context (Environment)
    Fill-in some details about your setup


    1. WordPress version: 4.5.20 I think – not sure as version doesn’t appear anywhere any more
    2. WP Customer Area version: 6.3.0
    3. Related add-ons versions:
    4. WP Customer Area 1.1.0
    5. WP Customer Area – Search 3.1.1
    6. WP Customer Area – Smart Groups 1.0.1
    #696477
    Vincent Mimoun-Prat
    Admin bbPress

    Hi,

    You are not using the latest version. Can you please try upgrading? We have made lots of improvements and fixes since then, and it may help in your case.

    After upgrading, if the problem still persists, can you also please let us know on which pages the issue appears / does not appear? This may help to focus on some queries and pinpoint the issue faster.

    Last thing, in the settings, are you showing all private files or are you using pagination (showing at most 5 to 10 files at once)?

    Regards,

    #696481
    paul_oneill
    Participant

    Hi Vincent

    According to this screenshot, only Search is out of date – and we don’t get to that point:

    20200428wpcaplugins

    Or have you literally just released updates?

    Thanks Vincent

    Pièces jointes:
    #696508
    Vincent Mimoun-Prat
    Admin bbPress

    Hi,

    https://wordpress.org/plugins/customer-area/

    Latest for the base plugin is 7.8.6

    Maybe your site update checker is broken (at least the base plugin version check should work as for any regular plugin hosted on WordPress.org)

    #696509
    Vincent Mimoun-Prat
    Admin bbPress

    From our archive : 6.3.0 (2015/11/26)

    Your version is almost 4 years old … 😉

    #696549
    paul_oneill
    Participant

    Yikes! Must be due to the older version of WordPress – will update and advise…

    Thanks Vincent

    #696650
    paul_oneill
    Participant

    OK WordPress is now current as are the CUAR plugins – still takes about 1 minute to load a clients’ file area.

    In other posts you’ve asked where the slow down occurs – what specifically are you looking got?

    Thanks Vincent

    #696728
    Vincent Mimoun-Prat
    Admin bbPress

    So you got a big improvement right?

    In other posts you’ve asked where the slow down occurs – what specifically are you looking for?

    On which pages is it slow?

    – Dashboard
    – Private files list page
    – Single private file
    – Private pages list page
    – Single private page
    – etc.

    Also, please have a look at your database tables wp_posts and wp_postmeta to see how many records are there. Did you try to do some cleanup?

    Is the rest of the website slow?

    Do you use groups, smart groups, additional owner types?

    Do you have many users on your site? How many more or less?

    #698004
    paul_oneill
    Participant

    Hi Vincent

    The website in general is fast enough – its the Client Files page that is particularly slow – takes about 1.5 minutes
    http://metlabsaust.com.au/customer-area-2/files/my-files/ (not a public page – sorry)

    wp_posts has 58176 rows and
    wp_postmeta has 339587 rows (WOW!!)

    We use Smart Groups with a custom user field (using ACF) to create the group members.

    I have written a custom loader that reads the file name which contains the group code, loads it using the API and assigns it to the group.

    As I said, this ran great until last year and then it went from OK to diabolically slow.
    We expected the move to a VPS to help but it didn’t so any suggestions you can offer will be greatly appreciated.

    Thanks Vincent

    .

    #698406
    Vincent Mimoun-Prat
    Admin bbPress
    Cette réponse a été marquée comme privée.
    #698799
    paul_oneill
    Participant

    Hi Vincent

    I have installed Query Monitor – very cool.
    Do you just want the query data?
    Does it have an export function?

    The custom loader I wrote is run as required to load more data.
    So, no, it does not impact any of the WPCA pages?

    Thanks Vincent

    #698800
    paul_oneill
    Participant

    Oh! With this plugin installed, I get an error 500 🙁
    (disabling it made the page work again…)

    #698887
    Vincent Mimoun-Prat
    Admin bbPress

    Any idea why a 500? (in the PHP logs)

    #698923
    paul_oneill
    Participant
    Cette réponse a été marquée comme privée.
    #699108
    Thomas Lartaud
    Admin bbPress

    Hi,

    Are you sure that you looked at the php_errors.log file? This kind of entry can usually be found in the php_access.log (or similar name), and this file is not reporting the errors. Errors can usually be found in a logfile that contains the word error.
    A 500 error entry should start with FATAL ERROR.

    Note: for your privacy, I marked your last post as private because it contains your IP address.

    Regards.

    #699138
    Thomas Lartaud
    Admin bbPress

    Also,

    The best debugging way to know where an issue comes from is still to check for a plugin conflict.
    In your case, I think you could try this:
    – deactivate ALL plugins on your site except WP Customer Area.
    – try to load the my-files page to see if it’s laggy (it should not)
    – activate the smart groups add-on
    – test the my-files page again
    – repeat the same process for each plugin

    I hope that helps.

    Regards.

    #700254
    paul_oneill
    Participant

    Hi Thomas

    We’ve pretty conclusively determined that the slowness of the my-files page is down to the number of client records we’ve uploaded.

    The plugin conflict seems to be caused by Query Monitor but I’ll take on Vincent’s suggestion to look for a PHP log file.

    Many thanks

    #700260
    Vincent Mimoun-Prat
    Admin bbPress

    Hi,

    You should also have a try at what Thomas suggests: disable some WPCA addons in order to see if one of them may be causing the issue (disable all, activate one by one until the page becomes slow again).

    #701833
    paul_oneill
    Participant

    Hey guys, thanks for your patience – I think I might be on to something….

    My recently moved from shared hosting to a VPS – both with HostGator, and now that I can see error messages I found that there were some settings pointing to the old server paths – now fixed and Query Monitor runs to completion.

    It now reports 2 slow queries:

    SELECT wp_posts.*
    FROM wp_posts
    WHERE 1=1
    AND wp_posts.post_type = 'cuar_smart_group'
    AND ((wp_posts.post_status = 'publish'))
    ORDER BY wp_posts.post_date DESC	+
    WP_Query->get_posts()
    Plugin: customer-area-smart-groups	5283	0.0999
    SELECT post_id, meta_key, meta_value
    FROM wp_postmeta
    WHERE post_id IN (74622,74620,74618,74616,74614,74612,74576,74571,74546,74541,74538,74519,74516,74514,74509,74507,74503,74488,74485,74467,74464,74373,74370,74334,74332,74279,74277,74275,74273,74270,74261,74259,74254,74253,74233,74230,74228,74226,74224,74222,74220,74218,74215,74204,74195,74185,74182,74180,74176,74174,74172,74168,74122,74117,74108,74076,74071,74068,74063,74056,74053,74042,74037,74032,74013,74008,73999,73974,73969,73966,73957,73913,73806,73767,73764,73737,73708,73703,73696,73645,73642,73625,73622,73617,73531,73526,73519,73495,73490,73485,73478,73433,73428,73413,73410,73345,73340,73323,73100,73087,73079,73066,73063,73046,73043,73009,73006,73001,72978,72973,72970,72963,72956,72909,72906,72891,72886,72883,72876,72869,72798,72791,72786,72781,72778,72775,72772,72769,72766,72763,72756,72753,72698,72691,72680,72677,72662,72647,72614,72609,72604,72589,72586,72511,72500,72475,72472,72465,72454,72437,72428,72403,72400,72395,72310,72303,72288,72283,72264,72261,72258,72255,72228,72225,72216,72213,72210,72204,72182,72171,72160,72151,72148,72145,72142,72139,72136,72133,72130,72107,72102,72075,72064,72061,72058,72055,72032,71997,71992,71987,71960,71811,71740,71729,71722,71717,71700,71691,71688,71685,71676,71647,71637,71632,71599,71594,71573,71570,71567,71564,71559,71556,71553,71550,71545,71536,71533,71524,71515,71502,71499,71486,71459,71424,71421,71406,71403,71398,71391,71388,71367,71307,71298,71295,71292,71289,71280,71277,71272,71237,71226,71221,71216,71207,71200,71175,71172,71169,71160,71157,71152,71147,71140,71086,71083,71080,71075,71066,71061,71058,71041,71038,71031,71018,70959,70956,70947,70944,70782,70775,70770,70767,70762,70757,70753,70748,70745,70742,70735,70666,70659,70656,70639,70610,70559,70531,70528,70521,70516,70511,70506,70499,70482,70479,70408,70400,70397,70394,70389,70386,70383,70372,70367,70352,70339,70332,70285,70270,70267,70252,70243,70234,70231,70226,70223,70125,70122,70069,70064,70057,70054,70031,70028,70023,70016,70013,69910,69897,69892,69885,69874,69871,69791,69788,69783,69780,69773,69718,69693,69670,69663,69660,69655,69612,69577,69570,69565,69562,69528,69525,69522,69493,69488,69420,69417,69414,69411,69408,69405,69370,69361,69344,69341,69338,69307,69300,69295,69286,69281,69278,69249,69246,69243,69224,69206,69203,69200,69197,69182,69177,69160,69157,69154,69149,69146,69141,69074,69063,69058,69051,69048,69045,69042,69017,69014,69009,69004,69001,68998,68995,68992,68952,68901,68876,68865,68862,68857,68814,68807,68804,68783,68774,68753,68746,68714,68656,68559,68556,68553,68550,68547,68544,68537,68528,68485,68480,68475,68472,68465,68443,68438,68435,68430,68427,68424,68421,68406,68383,68374,68369,68338,68286,68283,68280,68275,68198,68195,68192,68175,68145,68132,68033,68022,68019,68006,68003,67978,67973,67966,67963,67950,67945,67942,67939,67923,67823,67814,67803,67794,67729,67726,67671,67665,67646,67641,67636,67625,67622,67595,67590,67565,67558,67555,67550,67545,67538,67531,67520,67507,67500,67497,67484,67481,67478,67475,67464,67459,67435,67432,67429,67426,67421,67412,67409,67402,67395,67350,67293,67284,67223,67214,67195,67186,67183,67178,67173,67095,67090,67085,67074,67051,67022,67019,66998,66993,66992,66985,66980,66957,66936,66931,66922,66919,66906,66901,66898,66895,66892,66883,66858,66857,66848,66835,66828,66813,66790,66781,66774,66743,66724,66721,66650,66631,66620,66599,66590,66581,66578,66571,66568,66563,66560,66516,66513,66506,66499,66490,66487,66482,66433,66426,66423,66418,66409,66406,66356,66355,66346,66341,66338,66333,66324,66315,66312,66278,66275,66268,66265,66262,66259,66258,66225,66210,66205,66174,66167,66148,66145,66140,66131,66126,66036,65977,65968,65963,65956,65951,65940,65935,65930,65918,65915,65910,65909,65906,65885,65880,65871,65856,65851,65844,65839,65834,65812,65809,65806,65797,65794,65787,65786,65781,65768,65763,65756,65753,65748,65745,65722,65671,65666,65655,65646,65633,65626,65621,65547,65544,65541,65536,65533,65528,65523,65522,65499,65478,65475,65472,65469,65458,65455,65432,65429,65424,65411,65367,65364,65361,65354,65341,65326,65323,65318,65315,65265,65254,65231,65224,65217,65191,65188,65185,65178,65173,65164,65159,65152,65137,65134,65117,65092,65083,65074,65046,65043,65040,65039,65032,65027,65024,65019,65004,65001,64990,64985,64982,64979,64931,64928,64923,64918,64915,64908,64895,64892,64885,64882,64877,64874,64871,64868,64865,64862,64812,64809,64808,64799,64788,64777,64766,64761,64756,64743,64738,64718,64713,64710,64705,64696,64665,64662,64649,64636,64613,64594,64565,64562,64559,64554,64543,64506,64497,64482,64471,64466,64461,64456,64453,64440,64361,64358,64353,64344,64341,64338,64335,64318,64311,64308,64305,64300,64211,64202,64199,64194,64189,64184,64181,64180,64167,64146,64141,64138,64099,64096,64091,64086,64083,64078,64075,64070,64059,64054,64051,64046,64041,64038,64031,64015,64010,64007,64004,63997,63990,63976,63938,63935,63930,63923,63884,63830,63827,63824,63819,63808,63791,63782,63761,63756,63728,63719,63716,63711,63702,63695,63692,63689,63686,63681,63676,63671,63561,63558,63555,63548,63543,63540,63529,63510,63497,63486,63483,63480,63475,63470,63432,63429,63426,63423,63420,63413,63410,63379,63376,63353,63342,63310,63259,63256,63249,63236,63213,63208,63205,63202,63199,63187,63184,63181,63178,63141,63134,63115,63106,63073,63066,63061,63056,62994,62989,62986,62975,62970,62963,62950,62947,62942,62937,62932,62921,62918,62915,62912,62903,62900,62873,62868,62855,62840,62835,62828,62745,62742,62737,62732,62727,62718,62711,62708,62691,62682,62655,62652,62603,62569,62566,62561,62558,62549,62538,62533,62530,62523,62520,62515,62481,62466,62461,62433,62430,62427,62424,62421,62416,62411,62406,62399,62392,62389,62360,62347,62344,62325,62320,62299,62296,62269,62266,62239,62236,62190,62183,62174,62171,62150,62143,62106,62101,62059,62052,62047,62036,62033,62014,62007,61963,61960,61955,61952,61943,61936,61927,61916,61888,61877,61862,61851,61826,61821,61818,61815,61808,61801,61794,61725,61691,61690,61687,61684,61665,61662,61657,61652,61633,61594,61591,61584,61583,61513,61510,61509,61506,61503,61474,61461,61446,61421,61406,61391,61388,61385,61374,61367,61354,61341,61322,61319,61318,61309,61306,61303,61300,61295,61288,61262,61259,61256,61251,61246,61243,61238,61205,61200,61195,61192,61189,61186,61183,61178,61175,61172,61157,61144,61141,61136,61133,61128,61125,61122,61034,61029,61026,61023,61014,60980,60975,60950,60947,60944,60941,60938,60925,60912,60903,60900,60895,60867,60864,60861,60856,60853,60848,60845,60840,60837,60832,60829,60820,60811,60808,60774,60769,60766,60763,60760,60755,60752,60741,60738,60723,60720,60700,60695,60692,60675,60658,60655,60650,60643,60630,60609,60566,60553,60546,60543,60524,60517,60514,60370,60365,60346,60339,60336,60331,60318,60313,60302,60297,60288,60228,60221,60163,60148,60133,60109,60106,60099,60096,60091,60076,59997,59994,59972,59969,59964,59961,59958,59941,59932,59904,59889,59884,59820,59779,59768,59765,59762,59749,59735,59704,59699,59691,59684,59679,59676,59671,59656,59651,59646,59635,59600,59597,59592,59563,59560,59539,59517,59514,59507,59504,59501,59498,59491,59472,59467,59456,59453,59448,59445,59440,59324,59321,59316,59309,59304,59299,59241,59232,59191,59184,59163,59154,59149,59146,59142,59133,59124,59057,59054,59051,59044,59041,59036,59033,59028,59009,59006,58997,58992,58987,58960,58957,58952,58949,58936,58859,58844,58835,58685,58563,58554,58547,58536,58531,58528,58490,58485,58482,58473,58468,58465,58460,58447,58438,58435,58390,58385,58380,58340,58337,58334,58331,58328,58325,58318,58311,58308,58301,58296,58291,58280,58277,58266,58261,58256,58249,58232,58188,58185,58176,58171,58142,58004,57967,57962,57874,57871,57868,57861,57848,57839,57834,57818,57807,57796,57713,57710,57695,57638,57635,57630,57625,57622,57617,57612,57593,57588,57493,57484,57479,57448,57407,57366,57289,57282,57202,57197,57192,57179,57174,57169,57158,57151,57144,57141,57126,57123,57101,57098,57029,57012,57009,57006,56966,56963,56942,56933,56924,56921,56918,56903,56898,56884,56868,56865,56862,56797,56794,56791,56756,56753,56746,56737,56734,56729,56702,56699,56690,56687,56626,56619,56616,56554,56531,56511,56502,56493,56488,56485,56466,56455,56452,56449,56446,56437,56434,56431,56412,56407,56402,56381,56378,56371,56368,56365,56362,56349,56342,56327,56292,56283,56276,56228,56225,56220,56215,56208,56192,56187,56182,56177,56156,56149,56123,56118,56115,56106,56101,56096,56012,56009,56004,55999,55974,55935,55866,55863,55858,55845,55834,55829,55824,55794,55787,55760,55757,55754,55739,55722,55717,55714,55689,55680,55677,55674,55671,55668,55625,55616,55613,55608,55603,55578,55573,55570,55553,55548,55545,55536,55533,55530,55527,55473,55470,55467,55464,55453,55440,55373,55370,55365,55356,55327,55324,55227,55224,55221,55218,55195,55180,55177,55158,55155,55144,55116,55113,55079,55076,55073,55062,55041,55032,55029,55022,55015,54982,54979,54974,54965,54962,54949,54918,54913,54874,54863,54860,54857,54816,54811,54808,54801,54796,54785,54780,54765,54747,54708,54705,54698,54693,54688,54673,54670,54655,54652,54649,54646,54589,54584,54581,54578,54565,54552,54547,54544,54537,54534,54529,54522,54503,54498,54495,54377,54374,54365,54360,54341,54322,54317,54312,54307,54302,54297,54288,54283,54280,54275,54195,54190,54171,54150,54143,54140,54125,54120,54115,54108,54103,54098,54067,54064,54059,54056,54053,54044,53975,53972,53969,53966,53951,53948,53945,53914,53889,53882,53867,53850,53847,53838,53829,53802,53799,53792,53787,53782,53779,53776,53743,53738,53735,53722,53719,53712,53685,53682,53679,53668,53651,53648,53621,53618,53594,53591,53588,53581,53578,53571,53566,53563,53546,53543,53540,53537,53528,53503,53496,53493,53450,53447,53398,53389,53386,53381,53374,53371,53366,53353,53348,53312,53297,53292,53287,53284,53208,53205,53202,53185,53178,53175,53172,53165,53162,53137,53126,53123,53116,53113,53108,53099,53036,53031,53026,53023,53018,53015,53012,52989,52976,52969,52946,52939,52930,52895,52892,52887,52832,52827,52822,52815,52812,52781,52776,52686,52683,52674,52665,52662,52659,52654,52651,52622,52619,52616,52570,52565,52556,52553,52548,52545,52542,52539,52536,52529,52518,52513,52510,52507,52498,52491,52472,52465,52432,52425,52422,52377,52370,52363,52252,52247,52240,52237,52234,52231,52228,52225,52212,52209,52204,52163,52152,52149,52140,52125,52122,52115,52082,52077,52074,52071,52068,51933,51928,51919,51916,51911,51875,51872,51863,51778,51775,51772,51767,51764,51761,51742,51739,51732,51727,51710,51707,51704,51695,51690,51683,51680,51677,51670,51667,51664,51636,51633,51630,51611,51606,51603,51584,51579,51566,51563,51558,51438,51433,51430,51427,51424,51419,51400,51397,51380,51377,51366,51344,51341,51324,51313,51306,51287,51280,51275,51272,51263,51260,51192,51189,51168,51151,51148,51125,51116,51113,51108,51105,51094,51089,51082,51073,51070,51017,51014,51009,51006,51003,50987,50984,50979,50966,50963,50954,50945,50942,50939,50936,50909,50902,50899,50886,50873,50868,50855,50852,50849,50844,50837,50824,50819,50816,50813,50810,50803,50800,50793,50719,50716,50713,50710,50679,50547,50540,50456,50453,50448,50443,50440,50436,50426,50421,50418,50411,50406,50391,50360,50357,50354,50351,50330,50323,50320,50317,50314,50311,50306,50233,50222,50205,50138,50133,50124,50121,50116,50101,50094,50073,50056,50053,50032,50027,50012,50009,50006,49956,49951,49944,49941,49938,49919,49846,49837,49798,49795,49772,49757,49748,49745,49694,49679,49674,49669,49660,49611,49608,49605,49598,49593,49580,49577,49568,49516,49509,49502,49499,49496,49489,49486,49483,49462,49459,49456,49447,49396,49391,49388,49385,49382,49373,49322,49289,49286,49283,49280,49239,49236,49231,49226,49221,49204,49201,49180,49177,49170,49094,49085,49082,49075,49072,49069,49050,49045,49040,49035,48961,48956,48951,48930,48915,48908,48803,48800,48781,48776,48769,48746,48720,48717,48714,48711,48706,48685,48680,48677,48674,48639,48632,48623,48620,48615,48604,48561,48550,48503,48500,48497,48492,48485,48466,48463,48460,48455,48436,48431,48400,48393,48390,48350,48345,48338,48323,48316,48297,48290,48283,48278,48247,48128,48097,48094,48089,48086,48031,47983,47980,47923,47920,47917,47908,47891,47844,47839,47828,47821,47816,47795,47734,47709,47682,47588,47575,47528,47523,47516,47513,47510,47507,47485,47482,47479,47458,47449,47446,47443,47438,47433,47424,47421,47375,47358,47350,47347,47340,47337,47318,47309,47304,47301,47298,47287,47280,47277,47258,47251,47232,47225,47212,47203,47198,47193,47190,47185,47145,47132,47123,47110,47107,47082,47077,47072,47045,47042,47037,47030,47021,47016,46893,46890,46877,46870,46865,46862,46845,46842,46839,46820,46817,46814,46791,46778,46769,46766,46761,46758,46717,46714,46709,46706,46699,46626,46611,46606,46603,46590,46585,46560,46551,46544,46513,46456,46447,46438,46435,46432,46411,46408,46405,46398,46391,46388,46383,46356,46335,46330,46327,46322,46244,46235,46232,46203,46200,46195,46182,46179,46144,46137,46132,46129,46120,46117,46114,46105,46102,46093,46088,46059,46056,46053,46036,46017,46010,45977,45914,45907,45904,45899,45821,45818,45795,45746,45737,45734,45650,45621,45616,45585,45555,45552,45545,45532,45525,45522,45513,45510,45507,45504,45499,45496,45481,45478,45439,45436,45425,45410,45405,45402,45397,45320,45315,45312,45295,45282,45259,45216,45213,45204,45192,45187,45182,45171,45152,45147,45144,45139,45101,45088,45071,45066,45051,45040,45033,45020,45011,45004,44999,44951,44932,44923,44808,44795,44775,44772,44757,44746,44743,44716,44711,44708,44701,44698,44665,44660,44653,44642,44631,44626,44623,44618,44613,44608,44586,44583,44560,44535,44532,44519,44500,44489,44473,44468,44463,44458,44455,44418,44413,44408,44379,44376,44373,44354,44351,44341,44336,44329,44320,44317,44314,44301,44298,44285,44280,44265,44260,44257,44244,44221,44196,44187,44184,44181,44173,44170,44167,44154,44151,44138,44135,44132,44119,44114,44111,44067,44062,44051,44048,44035,44030,43983,43978,43961,43943,43938,43905,43808,43805,43756,43749,43744,43741,43738,43725,43718,43713,43710,43674,43671,43664,43657,43654,43649,43646,43643,43638,43631,43622,43613,43598,43585,43576,43573,43564,43485,43432,43425,43422,43387,43382,43369,43356,43286,43243,43174,43161,43156,43131,43120,43117,43106,43097,43090,43087,43078,43063,43060,43039,43034,43019,42978,42969,42960,42949,42920,42917,42906,42901,42898,42895,42852,42849,42844,42841,42838,42827,42812,42769,42710,42701,42698,42685,42680,42653,42650,42647,42478,42473,42470,42447,42444,42439,42420,42411,42408,42375,42364,42357,42354,42351,42348,42317,42314,42311,42296,42285,42268,42261,42258,42251,42246,42243,42234,42225,42222,42217,42214,42211,42076,42073,42070,42067,42050,42017,42012,42005,41998,41993,41988,41983,41980,41935,41932,41915,41898,41851,41848,41845,41842,41839,41826,41813,41810,41789,41786,41783,41744,41735,41710,41705,41700,41697,41644,41641,41638,41631,41628,41571,41544,41535,41532,41529,41524,41513,41500,41491,41472,41399,41396,41385,41382,41351,41322,41315,41298,41293,41261,41226,41221,41152,41143,41097,41094,41091,41088,41083,41054,41051,41032,41029,41012,40973,40938,40867,40864,40859,40842,40833,40826,40817,40814,40807,40802,40733,40730,40727,40718,40715,40708,40695,40673,40656,40649,40547,40538,40525,40514,40509,40504,40474,40471,40468,40449,40446,40441,40438,40435,40412,40389,40350,40323,40294,40287,40280,40151,40148,40135,40130,40103,40098,40093,40090,40049,40046,40007,40004,40001,39962,39957,39954,39907,39904,39881,39878,39873,39868,39796,39791,39788,39785,39782,39761,39740,39735,39682,39673,39668,39600,39595,39592,39589,39584,39575,39568,39563,39539,39532,39529,39524,39515,39508,39505,39481,39478,39461,39430,39425,39422,39378,39373,39364,39355,39350,39345,39338,39335,39310,39305,39302,39199,39194,39191,39170,39159,39156,39095,39092,39072,39067,39064,39053,39016,39013,38894,38885,38882,38877,38874,38871,38860,38841,38836,38833,38816,38813,38790,38787,38758,38739,38678,38663,38652,38649,38646,38637,38634,38618,38615,38612,38603,38596,38534,38529,38514,38505,38502,38493,38488,38454,38332,38327,38310,38301,38298,38293,38290,38287,38284,38234,38231,38228,38225,38218,38211,38182,38175,38172,38165,38156,38105,38098,38083,38080,38016,38013,38006,37975,37954,37945,37942,37931,37774,37769,37762,37755,37726,37721,37718,37703,37690,37683,37645,37636,37615,37608,37559,37554,37549,37521,37500,37495,37492,37479,37473,37470,37461,37456,37342,37339,37291,37158,37155,37148,37131,37126,37107,37104,37101,37092,37065,36817,36810,36793,36784,36757,36754,36748,36719,36714,36711,36684,36667,36604,36581,36578,36519,36512,36507,36502,36497,36492,36440,36435,36422,36419,36390,36387,36384,36381,36378,36373,36370,36365,36348,36331,36328,36325,36312,36275,36272,36261,36254,36216,36213,36210,36199,36196,36193,36186,36177,36175,36153,36146,36139,36134,36131,36124,36121,36116,36109,36106,36077,36046,36043,36038,36031,36030,35973,35968,35965,35960,35955,35952,35949,35936,35927,35920,35917,35880,35873,35868,35863,35858,35853,35846,35843,35834,35805,35751,35746,35743,35704,35681,35676,35655,35626,35623,35616,35611,35604,35599,35592,35587,35582,35577,35574,35546,35539,35536,35519,35516,35513,35508,35489,35486,35479,35476,35473,35448,35441,35438,35435,35432,35335,35330,35327,35324,35315,35310,35303,35298,35250,35247,35244,35239,35234,35215,35200,35193,35190,35181,35160,35157,35124,35117,35084,35061,35058,35051,35032,35029,35026,34969,34964,34949,34924,34884,34880,34873,34870,34865,34862,34849,34830,34827,34822,34815,34776,34771,34756,34719,34712,34709,34682,34679,34666,34657,34652,34639,34636,34621,34612,34609,34606,34601,34596,34575,34558,34555,34552,34537,34464,34420,34398,34395,34386,34381,34378,34323,34318,34303,34300,34297,34294,34251,34248,34243,34218,34215,34208,34163,34158,34151,34099,34094,34085,34082,34073,34064,34055,34052,33987,33976,33973,33970,33965,33962,33959,33946,33941,33938,33935,33906,33903,33900,33814,33811,33808,33767,33764,33755,33752,33745,33742,33739,33722,33713,33698,33693,33690,33687,33684,33647,33626,33613,33549,33544,33541,33508,33503,33462,33459,33450,33447,33370,33347,33334,33329,33274,33269,33256,33253,33244,33233,33230,33185,33182,33179,33174,33161,33150,33147,33144,33133,33116,33111,33108,33082,33075,33064,33055,33038,33033,32940,32937,32934,32913,32893,32888,32885,32880,32877,32874,32797,32794,32781,32775,32772,32763,32758,32751,32746,32737,32734,32725,32720,32707,32704,32695,32602,32597,32588,32581,32532,32527,32524,32515,32512,32507,32498,32449,32446,32443,32438,32433,32416,32411,32404,32350,32345,32324,32319,32316,32313,32282,32275,32264,32255,32252,32217,32214,32207,32174,32171,32114,32111,32104,32089,32072,32069,32062,32057,31989,31980,31969,31954,31947,31944,31941,31920,31917,31907,31904,31901,31896,31893,31886,31883,31878,31873,31852,31847,31834,31827,31720,31707,31694,31677,31674,31591,31474,31323,31318,31309,31304,31289,31284,31171,31155,31152,31149,31146,31143,31140,31123,31120,31064,31055,31052,31047,31040,31035,31012,31005,31002,30995,30988,30979,30976,30969,30964,30959,30956,30953,30901,30848,30778,30773,30770,30767,30764,30761,30724,30711,30706,30673,30668,30661,30656,30626,30617,30608,30603,30600,30595,30584,30577,30574,30569,30566,30561,30558,30545,30532,30527,30522,30517,30502,30499,30494,30483,30476,30471,30458,30415,30381,30372,30367,30364,30333,30323,30320,30315,30296,30289,30286,30279,30272,30267,30264,30261,30252,30241,30238,30207,30202,30177,30086,30065,30037,29987,29983,29980,29923,29918,29905,29898,29775,29772,29765,29762,29755,29750,29747,29744,29735,29645,29594,29587,29582,29550,29545,29538,29496,29489,29486,29475,29472,29451,29442,29419,29414,29387,29326,29321,29312,29299,29276,29261,29238,29233,29230,29215,29212,29209,29188,29133,29126,29098,29091,29066,28957,28948,28915,28898,28893,28888,28822,28809,28802,28760,28757,28752,28749,28734,28725,28722,28701,28698,28605,28592,28581,28576,28569,28509,28498,28495,28488,28409,28406,28399,28394,28391,28388,28385,28358,28355,28350,28345,28333,28314,28307,28304,28192,28177,28172,28169,28166,28157,28152,28149,28146,28107,28104,28101,28096,28087,28052,28027,28024,27993,27988,27933,27926,27921,27728,27719,27708,27687,27628,27597,27590,27579,27541,27538,27535,27532,27527,27516,27513,27494,27485,27405,27367,27364,27361,27358,27319,27316,27313,27310,27303,27298,27295,27237,27234,27201,27196,27191,27188,27097,27094,27074,27017,27012,26992,26987,26984,26981,26972,26963,26960,26935,26932,26927,26906,26897,26878,26859,26856,26853,26836,26833,26830,26823,26818,26813,26601,26591,26586,26581,26578,26571,26568,26547,26544,26541,26486,26483,26478,26424,26421,26307,26304,26301,26292,26287,26264,26259,26232,26227,26222,26217,26214,26159,26144,26139,26124,26119,26108,26103,26089,26044,26039,26004,25926,25923,25920,25915,25912,25907,25898,25893,25890,25870,25867,25860,25806,25803,25800,25769,25758,25755,25752,25749,25722,25715,25712,25709,25704,25699,25676,25671,25647,25640,25637,25568,25547,25413,25358,25353,25348,25275,25272,25259,25254,25210,25161,25136,25118,25076,25075,25062,25059,25046,25031,25022,25007,25002,24999,24970,24965,24962,24957,24926,24921,24916,24905,24824,24773,24769,24754,24751,24748,24735,24728,24694,24691,24672,24669,24651,24646,24639,24608,24597,24592,24587,24492,24489,24470,24409,24406,24399,24390,24387,24384,24351,24321,24288,24277,24227,24224,24221,24218,24199,24194,24184,24181,24178,24155,24060,24053,24048,24045,24042,24037,24032,24027,24022,24019,24014,24003,24000,23997,23994,23991,23956,23951,23924,23913,23910,23907,23904,23901,23898,23893,23888,23863,23856,23847,23832,23825,23822,23815,23794,23791,23723,23718,23715,23680,23673,23660,23641,23636,23629,23624,23601,23592,23517,23421,23418,23409,23404,23401,23398,23369,23366,23359,23356,23353,23339,23336,23329,23324,23321,23316,23313,23304,23293,23288,23275,23270,23267,23167,23164,23157,23154,23151,23148,23143,23130,23127,23069,23064,23033,23020,23017,22966,22963,22908,22903,22900,22897,22894,22891,22884,22879,22872,22861,22852,22849,22846,22839,22830,22827,22804,22795,22792,22789,22786,22750,22723,22710,22674,22591,22588,22585,22580,22567,22488,22483,22480,22451,22446,22427,22424,22403,22376,22373,22370,22342,22339,22336,22297,22294,22283,22280,22277,22268,22263,22262,22168,22145,22027,22020,22013,22010,22007,21972,21969,21960,21957,21954,21911,21908,21905,21898,21891,21802,21799,21792,21779,21669,21666,21658,21653,21646,21643,21638,21633,21626,21612,21609,21606,21603,21600,21583,21578,21565,21560,21547,21540,21533,21440,21437,21434,21429,21426,21421,21412,21407,21404,21401,21386,21383,21345,21342,21339,21336,21333,21328,21325,21320,21315,21308,21305,21285,21278,21263,21209,20736,20733,20718,20715,20710,20707,20700,20691,20684,20679,20672,20663,20660,20657,20604,20597,20562,20511,20494,20479,20462,20426,20413,20408,20407,20404,20367,20354,20341,20338,20247,20242,20235,20232,20227,20214,20211,20198,20191,20178,20171,20156,20143,20123,20120,20113,20110,20103,20098,20095,20092,20073,20070,20067,20062,20059,20056,20053,20044,19920,19905,19890,19868,19861,19858,19823,19812,19793,19788,19779,19776,19771,19732,19686,19675,19668,19665,19598,19593,19584,19577,19546,19541,19530,19527,19524,19521,19504,19493,19488,19485,19469,19464,19415,19410,19405,19376,19354,19345,19336,19331,19328,19323,19291,19286,19269,19241,19238,19233,19228,19225,19184,19181,19164,19161,19158,19131,19128,19125,19114,19111,19106,19103,19098,19093,19084,19081,19076,19071,19068,19057,19048,19037,19034,19031,19016,19013,19010,19007,19002,18999,18992,18866,18861,18856,18853,18840,18829,18826,18821,18818,18811,18804,18801,18783,18778,18729,18726,18723,18718,18707,18694,18689,18686,18683,18676,18669,18654,18647,18642,18635,18630,18617,18576,18567,18562,18559,18509,18504,18470,18465,18462,18459,18454,18435,18426,18423,18418,18404,18375,18360,18294,18285,18282,18271,18264,18236,18227,18224,18215,18206,18203,18190,18166,18157,18150,18147,18121,18116,18113,18108,18103,18100,18095,18076,18071,18062,18051,18020,18015,18010,17971,17948,17945,17940,17929,17926,17913,17822,17801,17798,17793,17788,17763,17716,17709,17698,17695,17661,17654,17651,17648,17645,17640,17635,17620,17615,17610,17605,17598,17589,17518,17511,17508,17489,17486,17450,17445,17442,17437,17428,17425,17420,17411,17408,17403,17400,17397,17365,17346,17343,17334,17327,17318,17315,17308,17299,17296,17289,17286,17283,17278,17181,17178,17175,17166,17163,17154,17145,17138,17133,17113,17110,17105,17096,17093,17090,17087,17084,17055,17052,17041,17036,17003,16999,16992,16989,16986,16973,16968,16965,16962,16947,16942,16939,16887,16884,16879,16858,16851,16846,16839,16834,16829,16812,16807,16802,16774,16771,16766,16755,16730,16725,16717,16712,16699,16653,16646,16631,16628,16562,16559,16554,16547,16538,16535,16530,16527,16522,16490,16487,16484,16479,16476,16428,16419,16416,16401,16398,16395,16382,16347,16344,16323,16318,16303,16298,16282,16275,16266,16257,16252,16237,16200,16197,16192,16175,16172,16155,16148,16143,16136,16133,16088,16085,16080,16075,16072,16067,16064,16038,16035,16020,16017,16012,16007,16004,16001,15996,15993,15988,15985,15978,15973,15970,15963,15960,15941,15938,15933,15891,15876,15833,15828,15819,15814,15811,15747,15744,15727,15724,15709,15706,15700,15693,15678,15675,15670,15665,15607,15604,15599,15592,15589,15586,15581,15578,15557,15542,15539,15470,15465,15460,15428,15425,15416,15409,15406,15395,15390,15383,15363,15340,15337,15334,15329,15318,15299,15290,15287,15274,15269,15266,15259,15246,15237,15222,15219,15176,15169,15156,15151,15146,15141,15136,15133,15030,15023,15018,15015,15010,15003,15000,14997,14944,14919,14900,14895,14886,14842,14821,14816,14811,14808,14799,14794,14791,14724,14719,14706,14703,14657,14654,14651,14646,14635,14626,14564,14561,14552,14549,14546,14541,14538,14527,14506,14503,14500,14495,14490,14487,14482,14479,14468,14465,14460,14451,14404,14397,14386,14381,14378,14369,14346,14343,14340,14314,14311,14264,14259,14246,14243,14240,14237,14234,14231,14228,14223,14220,14215,14206,14153,14150,14147,14144,14139,14089,14084,14075,14072,14042,14039,14034,14031,14026,14017,14014,14011,14000,13997,13994,13989,13980,13969,13966,13963,13960,13957,13913,13908,13903,13886,13881,13872,13869,13862,13760,13757,13754,13749,13742,13737,13732,13727,13724,13658,13649,13644,13641,13636,13633,13610,13601,13598,13595,13592,13589,13542,13537,13532,13529,13526,13523,13391,13388,13383,13378,13371,13366,13361,13358,13355,13346,13343,13340,13262,13255,13252,13249,13232,13225,13222,13217,13216,13213,13206,13177,13174,13169,13132,13117,13114,13111,13106,13103,13088,13085,13080,13073,13072,13069,13062,13059,13054,13047,12963,12960,12951,12942,12933,12926,12923,12912,12907,12902,12875,12872,12865,12860,12857,12825,12808,12791,12788,12785,12782,12765,12762,12741,12736,12687,12684,12679,12660,12655,12650,12565,12552,12547,12538,12525,12522,12517,12514,12511,12508,12503,12500,12495,12476,12473,12458,12455,12448,12433,12428,12425,12393,12388,12385,12382,12367,12364,12361,12356,12323,12306,12303,12298,12293,12290,12281,12278,12212,12199,12196,12142,12139,12134,12120,12078,12073,12070,12065,12044,12016,12011,12006,12003,11897,11892,11881,11878,11875,11872,11858,11835,11822,11819,11814,11809,11806,11799,11781,11731,11728,11718,11713,11708,11705,11700,11697,11686,11677,11672,11669,11664,11628,11625,11620,11615,11608,11587,11584,11569,11536,11529,11522,11519,11516,11513,11510,11507,11502,11499,11496,11392,11387,11382,11375,11364,11341,11336,11309,11304,11299,11296,11263,11250,11237,11218,11209,11204,11199,11194,11187,11184,11175,11170,11115,11112,11109,11104,11097,11094,11087,11084,11077,11074,11071,11068,11065,11058,11053,11050,11047,11044,11041,10957,10954,10951,10948,10941,10924,10919,10916,10913,10908,10905,10869,10866,10859,10850,10841,10807,10804,10801,10798,10793,10790,10787,10784,10779,10747,10744,10741,10738,10735,10732,10729,10728,10723,10718,10715,10710,10707,10704,10693,10684,10679,10635,10628,10625,10618,10609,10596,10593,10549,10542,10539,10536,10531,10488,10485,10478,10473,10470,10467,10464,10461,10458,10445,10442,10435,10432,10427,10416,10388,10383,10331,10324,10321,10316,10286,10281,10278,10267,10262,10257,10193,10182,10179,10174,10169,10164,10157,10150,10147,10081,10078,10065,10062,10057,10052,10012,10009,10002,9991,9986,9981,9952,9937,9932,9927,9924,9915,9908,9845,9840,9835,9826,9817,9806,9801,9796,9789,9786,9775,9772,9734,9731,9728,9666,9655,9650,9645,9638,9623,9618,9613,9604,9599,9590,9573,9568,9523,9518,9515,9512,9501,9463,9454,9420,9409,9312,9309,9306,9301,9262,9255,9246,9237,9222,9217,9131,9128,9125,9122,9113,9110,9107,9098,9093,9060,9055,9048,9039,9019,9014,9001,8998,8935,8930,8927,8924,8914,8909,8906,8903,8898,8854,8851,8846,8821,8814,8809,8800,8795,8792,8789,8786,8743,8740,8733,8730,8715,8663,8658,8639,8636,8629,8624,8615,8600,8597,8586,8583,8580,8577,8572,8569,8527,8516,8511,8485,8480,8477,8474,8469,8466,8461,8427,8421,8402,8397,8392,8363,8360,8357,8354,8351,8344,8339,8330,8327,8324,8321,8314,8261,8228,8225,8222,8215,8210,8207,8200,8197,8184,8181,8155,8150,8143,8120,8117,8114,8111,8104,8097,8092,8083,8074,8063,8033,8026,8019,8004,7999,7992,7989,7921,7916,7909,7898,7891,7882,7844,7837,7832,7829,7826,7797,7784,7709,7694,7689,7684,7681,7668,7605,7602,7597,7568,7565,7562,7557,7554,7531,7522,7501,7498,7491,7481,7478,7449,7446,7443,7438,7435,7412,7403,7382,7379,7372,7326,7323,7320,7311,7308,7305,7300,7297,7288,7279,7264,7261,7256,7243,7230,7227,7220,7217,7212,7209,7111,7094,7067,7044,7041,7038,7009,6994,6991,6982,6973,6970,6963,6954,6951,6924,6919,6912,6901,6888,6885,6847,6838,6835,6824,6819,6816,6811,6808,6795,6792,6789,6774,6771,6714,6705,6690,6685,6682,6679,6676,6558,6531,6524,6519,6514,6505,6423,6418,6401,6386,6326,6305,6302,6277,6272,6265,6254,6241,6238,6233,6224,6217,6202,6179,6174,6171,6096,6055,6048,6041,6010,5995,5992,5981,5978,5973,5970,5963,5944,5941,5924,5917,5914,5911,5817,5814,5793,5790,5787,5725,5664,5661,5642,5623,5614,5609,5549,5546,5541,5536,5533,5530,5509,5479,5472,5463,5458,5449,5434,5431,5391,5388,5363,5356,5253,5240,5231,5220,5217,5167,5164,5159,5156,5137,5132,5127,5124,5121,5110,5108,5089,5080,5059,5056,5051,5027,5012,4976,4973,4960,4947,4928,4867,4864,4861,4842,4835,4828,4823,4812,4779,4776,4757,4700,4697,4694,4648,4635,4626,4617,4550,4547,4542,4539,4534,4511,4504,4476,4473,4470,4467,4464,4457,4454,4419,4326,4313,4308,4269,4262,4214,4209,4158,4137,4106,4101,4096,4022,4019,4010,4003,3994,3965,3962,3959,3956,3939,3934,3889,3886,3881,3864,3828,3813,3810,3807,3786,3758,3753,3742,3737,3734,3679,3670,3654,3649,3646,3641,3636,3630,3605,3588,3585,3582,3579,3564,3561,3550,3541,3538,3535,3504,3495,3484,3481,3478,3425,3392,3389,3384,3369,3366,3363,3360,3341,3334,3323,3314,3138,3135,3132,3129,3124,3117,3114,3109,3084,3029,2902,2889,2876,2755,2744,2743,2734,2729,2726,2714,2676,2659,2656,2647,2509,2488,2483,2480,2479,2474,2467,2461,2458,2443,2440,2437,2434,2422,2401,2375,2374,2369,2360,2354,2339,2309,2306,2303,2281,2278,2264,2259,2258,2253,2250,2247,2236,2233,2210,2207,2204,2162,2127,2124,2121,2120,2115,2112,2101,2063,2007,2002,1999,1996,1969,1951,1930,1923,1908,1905,1900,1893,1890,1855,1818,1811,1798,1787,1784,1777,1736,1733,1730,1727,1718,1711,1708,1703,1636,1591,1588,1577,1408,1373,1370,1367,1364,1361,1358,1355,1352,1347,1316,1313,1300,1237,1028,963,960,951,928,901,898,889,792,757,700,693,468,465,406,401,334,329,324,319,300,285,268,259)
    

    When I grab the first few rows in PHP MyAdmin, I can see that this is retrieving cuar_criteria_search and cuar_criteria_meta values for what appear to be my Smart Groups.

    So now we’re getting somewhere. By my reckoning we have 5282 cuar_criteria_search values in the wp_postmeta table – presumably there is one of these for each Smart Group entry.

    If that is the case, my next question is: is there an easy way to reassign files to smart groups within the existing plugins capability, or will I need to write some funky code?

    The post title for uploaded files is consistently like this: 20CGC290-01
    20 represents this year
    CGC represents the client/smart group code
    290 is the job number and
    01 is the task number

    All we really want is for CGC people to ONLY see CGC files – preferably grouped by year but definitely sorted newest to oldest.

    This problem has probably been caused when my code tried to find an existing Smart Group and then couldn’t.
    I’ll post that snippet in a separate message for you to look at.

    TIA
    Paul

    #701835
    paul_oneill
    Participant

    Here’s my code to find a smart group, or create one if not found – so it ALWAYS returns a Smart Group ID:

            function find_or_create_smart_group($client_code)
            {
              /* DEBUG:
              echo "Client code: ";
              var_dump($client_code);
              echo "\n";
              // END DEBUG */
              
              // Do we have a smart group already?
              $groups = new WP_Query( array (
                                        'post_type'   => array( 'cuar_smart_group' ),
                                        //'post_title'  => $client_code /* ,
                                        'post_title'  => $client_code,
                                        'post_status'   => 'publish' /* ,
                                        'fields' => 'ids' */
    
              ));
              /* Debug:
              echo "Posts:\n<pre>\n";
              var_dump($groups->posts);
              echo "</pre>\n";
              // */
              
              $sgID = -1;
              while ($groups->have_posts())
              {
                // We have groups – make sure it's the right one
                $groups->the_post();
                //var_dump("Checking: " . get_the_title());
                
                if (get_the_title() == $client_code)
                {
                  $sgID = $groups->post->ID;
                  //var_dump("Found: " . $sgID);
                }
              }
              
              if ($sgID == -1)
              {
                // Group not found – we need to create a smart group
                // – start with a simple post of type 'cuar_smart_group'
                // Create post object
                $sg_post = $my_post = array(
                              'post_type'   => 'cuar_smart_group',
                              'post_title'  => $client_code,
                              'post_status'   => 'publish',
                              'post_author'   => 1
                );
                 
                // Insert the post into the database
                $sgID  = wp_insert_post( $sg_post );
                //var_dump("Created: " . $sgID);
                
                // Now append the smart group criteria
                $sg_addon = cuar_addon('smart-groups');
                $sg_addon->disable_search_criteria($sgID);
                $sg_addon->enable_meta_criteria(
                                              $sgID,                // The group ID from above
                                              'OR',                // You can use OR, but same thing if you have a single criteria
                                              array(  array(
                                                  'compare' => '=',
                                                  'key'     => 'Code',
                                                  'value'   => $client_code
                                              ) )
                );
                
              } else {
                // Group already found and set – continue
              }
              
              //var_dump($sgID);
              return $sgID;
            }
    
20 sujets de 1 à 20 (sur un total de 25)
  • Vous devez être connecté pour répondre à ce sujet.